Skip to content

Commit

Permalink
Too much tokens: prompt tokens (4307) + completion tokens (200) > tok…
Browse files Browse the repository at this point in the history
…ens limit (4095).
  • Loading branch information
rcmdnk committed Sep 17, 2023
1 parent 74e378a commit 433aacd
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 60 deletions.
4 changes: 1 addition & 3 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ aboutme_marks: false

# jQuery
jquery_version: 3.7.0
jquery_ie8_version: 1.9.1

# Font Awesome
fontawesome_version: 4.7.0
Expand Down Expand Up @@ -316,8 +315,7 @@ userlocal:

# page-view settings (need service account private key file (key_file). ref: https://github.com/developmentseed/jekyll-ga)
page-view:
credential:
key_file: # service account private key file (Analytics-XXXXXXXXXXXX.p12)
credential: # service account credential json file
property_id: # Analytics property id (XXXXXXXX)
start: # Beginning of report
- 30daysAgo
Expand Down
2 changes: 1 addition & 1 deletion patches/Gemfile.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/Gemfile b/Gemfile
index 5683812..066ef1f 100644
index 5683812..5d6ceb3 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,18 +1,25 @@
Expand Down
93 changes: 49 additions & 44 deletions patches/Rakefile.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
--- Rakefile.orig 2022-08-06 01:52:04.902606200 +0900
+++ Rakefile 2022-08-06 02:06:44.542606200 +0900
diff --git a/Rakefile b/Rakefile
index 9367ea1..bd0ca80 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,6 +1,8 @@
require "rubygems"
require "bundler/setup"
Expand All @@ -9,7 +11,7 @@

## -- Rsync Deploy config -- ##
# Be sure your public key is listed in your server's ~/.ssh/authorized_keys file
@@ -9,27 +11,45 @@
@@ -9,27 +11,45 @@ ssh_port = "22"
document_root = "~/website.com/"
rsync_delete = false
rsync_args = "" # Any extra arguments to pass to rsync
Expand Down Expand Up @@ -60,13 +62,15 @@
end

desc "Initial setup for Octopress: copies the default theme into the path of Jekyll's generator. Rake install defaults to rake install[classic] to install a different theme run rake install[some_theme_name]"
@@ -52,47 +72,192 @@
@@ -52,47 +72,192 @@ end
# Working with Jekyll #
#######################

-desc "Generate jekyll site"
-task :generate do
+desc "Update stylesheets. Give an argument as nested, expanded, compact or compressed (default) to the output style."
+task :css, :style do |t, args|
+ raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
+ puts "## Update stylesheets"
+ style = minify ? "-s compressed" : "-s nested"
+ if args.style
Expand All @@ -76,10 +80,9 @@
+ cp_r "#{source_dir}/stylesheets/.", "#{public_dir}/stylesheets/"
+end
+
desc "Generate jekyll site"
-task :generate do
+desc "Generate jekyll site"
+task :generate, :opt do |t, args|
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
+ raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
+
+ opt = args.opt ? args.opt : ""
+
Expand Down Expand Up @@ -262,7 +265,7 @@
# usage rake new_post[my-new-post] or rake new_post['my new post'] or rake new_post (defaults to "new-post")
desc "Begin a new post in #{source_dir}/#{posts_dir}"
task :new_post, :title do |t, args|
@@ -102,20 +267,39 @@
@@ -102,20 +267,39 @@ task :new_post, :title do |t, args|
title = get_stdin("Enter a title for your post: ")
end
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
Expand Down Expand Up @@ -305,7 +308,7 @@
end
end

@@ -125,8 +309,10 @@
@@ -125,8 +309,10 @@ task :new_page, :filename do |t, args|
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
args.with_defaults(:filename => 'new-page')
page_dir = [source_dir]
Expand All @@ -317,7 +320,7 @@
title = filename
page_dir.concat($1.downcase.sub(/^\//, '').split('/')) unless $1.nil? # Add path to page_dir Array
if extension.nil?
@@ -147,10 +333,13 @@
@@ -147,10 +333,13 @@ task :new_page, :filename do |t, args|
page.puts "---"
page.puts "layout: page"
page.puts "title: \"#{title}\""
Expand All @@ -332,7 +335,7 @@
page.puts "---"
end
else
@@ -161,21 +350,49 @@
@@ -161,21 +350,49 @@ end
# usage rake isolate[my-post]
desc "Move all other posts than the one currently being worked on to a temporary stash location (stash) so regenerating the site happens much more quickly."
task :isolate, :filename do |t, args|
Expand All @@ -344,12 +347,12 @@
+ filename = args.filename
+ else
+ filename = Dir.glob("#{source_dir}/#{posts_dir}/*.#{new_post_ext}").sort_by{|f| File.mtime(f)}.last
+ end
end
+ if filename == nil
+ puts "## Stashing all posts"
+ else
+ puts "## Stashing other posts than #{filename}"
end
+ end
+ FileUtils.mkdir(full_stash_dir) unless File.exist?(full_stash_dir)
+ Dir.glob("#{source_dir}/#{posts_dir}/*") do |post|
+ if filename != nil && post.include?(filename)
Expand Down Expand Up @@ -389,7 +392,7 @@
end

desc "Move sass to sass.old, install sass theme updates, replace sass/custom with sass.old/custom"
@@ -215,8 +432,14 @@
@@ -215,8 +432,14 @@ end
##############

desc "Default deploy task"
Expand All @@ -406,7 +409,7 @@
if File.exists?(".preview-mode")
puts "## Found posts in preview mode, regenerating files ..."
File.delete(".preview-mode")
@@ -224,11 +447,32 @@
@@ -224,11 +447,32 @@ task :deploy do
end

Rake::Task[:copydot].invoke(source_dir, public_dir)
Expand Down Expand Up @@ -441,7 +444,7 @@
end

desc "copy dot files for deployment"
@@ -245,74 +489,105 @@
@@ -245,74 +489,105 @@ task :rsync do
exclude = "--exclude-from '#{File.expand_path('./rsync-exclude')}'"
end
puts "## Deploying website via Rsync"
Expand Down Expand Up @@ -469,7 +472,8 @@
puts "\n## Committing: #{message}"
- system "git commit -m \"#{message}\""
+ ok_failed("git commit -m \"#{message}\"")
+ puts "\n## Pushing generated #{deploy_dir} website"
puts "\n## Pushing generated #{deploy_dir} website"
- Bundler.with_clean_env { system "git push origin #{deploy_branch}" }
+ output = (use_token)? " >/dev/null 2>&1":""
+ Bundler.with_original_env { ok_failed("git push origin #{deploy_branch} #{output}") }
+ puts "\n## Github Pages deploy complete"
Expand Down Expand Up @@ -500,8 +504,7 @@
+ message = "Site updated at #{Time.now.utc}"
+ ok_failed("git commit -m \"#{message}\" >/dev/null")
+ ok_failed("git branch -m #{deploy_branch}")
puts "\n## Pushing generated #{deploy_dir} website"
- Bundler.with_clean_env { system "git push origin #{deploy_branch}" }
+ puts "\n## Pushing generated #{deploy_dir} website"
+ output = (use_token) ? " >/dev/null 2>&1" : ""
+ Bundler.with_unbundled_env { ok_failed("git push -u -f origin #{deploy_branch} #{output}") }
puts "\n## Github Pages deploy complete"
Expand Down Expand Up @@ -570,7 +573,7 @@
repo_url = get_stdin("Repository url: ")
end
protocol = (repo_url.match(/(^git)@/).nil?) ? 'https' : 'git'
@@ -322,23 +597,25 @@
@@ -322,23 +597,25 @@ task :setup_github_pages, :repo do |t, args|
user = repo_url.match(/github\.com\/([^\/]+)/)[1]
end
branch = (repo_url.match(/\/[\w-]+\.github\.(?:io|com)/).nil?) ? 'gh-pages' : 'master'
Expand All @@ -588,25 +591,26 @@
- system "git remote add origin #{repo_url}"
- puts "Added remote #{repo_url} as origin"
- system "git config branch.master.remote origin"
- puts "Set origin as default remote"
- system "git branch -m master source"
- puts "Master branch renamed to 'source' for committing your blog source files"
- else
- unless !public_dir.match("#{project}").nil?
- system "rake set_root_dir[#{project}]"
+ ok_failed("git remote add origin #{repo_url}")
+ if use_token
+ puts "Added given remote as origin"
+ else
+ puts "Added remote #{repo_url} as origin"
+ end
end
+ ok_failed("git config branch.master.remote origin")
puts "Set origin as default remote"
- system "git branch -m master source"
+ puts "Set origin as default remote"
+ ok_failed("git branch -m master source")
puts "Master branch renamed to 'source' for committing your blog source files"
- else
- unless !public_dir.match("#{project}").nil?
- system "rake set_root_dir[#{project}]"
- end
+ puts "Master branch renamed to 'source' for committing your blog source files"
end
end
url = blog_url(user, project, source_dir)
@@ -347,31 +624,56 @@
@@ -347,31 +624,56 @@ task :setup_github_pages, :repo do |t, args|
File.open('_config.yml', 'w') do |f|
f.write jekyll_config
end
Expand All @@ -624,7 +628,6 @@
- rakefile.sub!(/deploy_default(\s*)=(\s*)(["'])[\w-]*["']/, "deploy_default\\1=\\2\\3push\\3")
- File.open(__FILE__, 'w') do |f|
- f.write rakefile
- end
+
+ rakefile = IO.read(__FILE__)
+ rakefile.sub!(/deploy_branch(\s*)=(\s*)(["'])[\w-]*["']/, "deploy_branch\\1=\\2\\3#{branch}\\3")
Expand All @@ -634,15 +637,10 @@
+ ext = 'markdown'
+ if ask("Do you want to use 'md' extension instead of 'markdown'?", ['y', 'n'], args.yes) == "y"
+ ext = 'md'
end
- puts "\n---\n## Now you can deploy to #{repo_url} with `rake deploy` ##"
-end
+ end
+ rakefile.sub!(/new_post_ext(\s*)=(\s*)(["'])[\w-]*["']/, "new_post_ext\\1=\\2\\3#{ext}\\3")
+ rakefile.sub!(/new_page_ext(\s*)=(\s*)(["'])[\w-]*["']/, "new_page_ext\\1=\\2\\3#{ext}\\3")

-def ok_failed(condition)
- if (condition)
- puts "OK"
+
+ if ask("Do you want to push_ex (renew remote repository evrey time)?", ['y', 'n'], args.yes) == 'y'
+ if yn_check(args.yes) == "y"
+ dir = ""
Expand All @@ -658,8 +656,7 @@
+ end
+ rakefile.sub!(/deploy_default(\s*)=(\s*)(["'])[\w-]*["']/, "deploy_default\\1=\\2\\3push_ex\\3")
+ rakefile.sub!(/(tmp_dir\s*=\s*File.expand_path\()(["'])[^"']*["']/,"\\1\\2#{dir}\\2")
else
- puts "FAILED"
+ else
+ rm_rf deploy_dir
+ mkdir deploy_dir
+ cd "#{deploy_dir}" do
Expand All @@ -675,16 +672,24 @@
+ puts "\n---\n## Now you can deploy with `rake deploy` ##"
+ else
+ puts "\n---\n## Now you can deploy to #{repo_url} with `rake deploy` ##"
+ end
+ end
end
end
- puts "\n---\n## Now you can deploy to #{repo_url} with `rake deploy` ##"
-end
-
-def ok_failed(condition)
- if (condition)
- puts "OK"
- else
- puts "FAILED"
+ File.open(__FILE__, 'w') do |f|
+ f.write rakefile
end
+ ok_failed("rake set_root_dir[#{project}]")
end

def get_stdin(message)
@@ -379,9 +681,22 @@
@@ -379,9 +681,22 @@ def get_stdin(message)
STDIN.gets.chomp
end

Expand All @@ -709,7 +714,7 @@
else
answer = get_stdin(message)
end
@@ -404,3 +719,336 @@
@@ -404,3 +719,336 @@ task :list do
puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).join(', ')}"
puts "(type rake -T for more detail)\n\n"
end
Expand Down
7 changes: 3 additions & 4 deletions patches/_config.yml.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/_config.yml b/_config.yml
index c1d56f4..d6d2191 100644
index c1d56f4..26d3572 100644
--- a/_config.yml
+++ b/_config.yml
@@ -2,24 +2,57 @@
Expand Down Expand Up @@ -242,7 +242,7 @@ index c1d56f4..d6d2191 100644

# Disqus Comments
disqus_short_name:
@@ -99,3 +220,177 @@ google_analytics_tracking_id:
@@ -99,3 +220,172 @@ google_analytics_tracking_id:

# Facebook Like
facebook_like: false
Expand Down Expand Up @@ -341,8 +341,7 @@ index c1d56f4..d6d2191 100644
+
+# page-view settings (need service account private key file (key_file). ref: https://github.com/developmentseed/jekyll-ga)
+page-view:
+ credential:
+ key_file: # service account private key file (Analytics-XXXXXXXXXXXX.p12)
+ credential: # service account credential json file
+ property_id: # Analytics property id (XXXXXXXX)
+ start: # Beginning of report
+ - 30daysAgo
Expand Down
8 changes: 0 additions & 8 deletions source/_includes/async.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,8 @@
<script src="//www.linkwithin.com/widget.js" async defer></script>
{% endif %}
{% if page.math %}<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" async defer></script>{% endif %}}
{% comment %}jQuery{% endcomment %}
{% if site.jquery_ie8_version %}
<!--[if lt IE 9]>
<script src="//ajax.googleapis.com/ajax/libs/jquery/{{jquery_ie8_version}}/jquery.min.js" defer></script>
<![endif]-->
{% endif %}
{% if site.jquery_version %}
<!--[if gte IE 9]><!-->
<script src="//ajax.googleapis.com/ajax/libs/jquery/{{site.jquery_version}}/jquery.min.js" defer></script>
<!--<![endif]-->
{% endif %}
{% comment %}
<script>!window.jQuery && document.write(unescape('%3Cscript src="{{root_url}}/javascripts/libs/jquery.min.js"%3E%3C/script%3E'))</script>
Expand Down

0 comments on commit 433aacd

Please sign in to comment.