This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| import click | |
| import os | |
| import pandas as pd | |
| def file_split(file): | |
| s = file.split('.') | |
| name = '.'.join(s[:-1]) # get directory name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # How to use acme.sh to set up Let's Encrypt, with the script being run | |
| # mostly without root permissions | |
| # See https://github.com/Neilpang/acme.sh for more | |
| # These instructions use the domain "EXAMPLE.COM" as an example | |
| # These instructions: | |
| # - work on Ubuntu 18.04 and 20.04 with nginx | |
| # - use CloudFlare DNS validation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # More robust version to update new or existing counter cache columns in your Rails app. | |
| # See: https://gist.github.com/svyatov/4225663 | |
| desc 'Update all cache counters' | |
| task :update_cache_counters => :environment do | |
| models_to_update = {} | |
| # or: Rails.application.eager_load! | |
| # Dir loads less, so it's faster | |
| Dir.glob(Rails.root.join('app/models/**/*')).each { |model| require model if File.file?(model) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ———————————————————————————————————————————————————————————————————————————————————————————————————— | |
| BBEDIT/TEXTWRANGLER REGULAR EXPRESSION GUIDE MODIFIED 2014-01-13 : 00:12 | |
| ———————————————————————————————————————————————————————————————————————————————————————————————————— | |
| NOTES: | |
| The PCRE engine (Perl Compatible Regular Expressions) is what BBEdit and TextWrangler use. | |
| Items I'm unsure of are marked '# PCRE?'. The list while fairly comprehensive is not complete. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class RemoveMetaKeywordsFromSeoMeta < ActiveRecord::Migration | |
| def up | |
| with_index_name_fix do | |
| remove_column :seo_meta, :meta_keywords | |
| end | |
| end | |
| def down | |
| add_column :seo_meta, :meta_keywords, :string | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| def e_sh(str) | |
| str.to_s.gsub(/(?=[^a-zA-Z0-9_.\/\-\x7F-\xFF\n])/n, '\\').gsub(/\n/, "'\n'").sub(/^$/, "''") | |
| end | |
| def find_headers(lines) | |
| in_headers = false | |
| lines.each_with_index {|line, i| | |
| if line =~ /^\S[^\:]+\:( .*?)?$/ |