Kill and restart gpg agent (Fish Shell)
pkill gpg-agent ; gpg-agent --daemon
git commit -S --amend
# Rails 5 | |
ActiveModel::Type::Boolean.new.cast('t') # => true | |
ActiveModel::Type::Boolean.new.cast('true') # => true | |
ActiveModel::Type::Boolean.new.cast(true) # => true | |
ActiveModel::Type::Boolean.new.cast('1') # => true | |
ActiveModel::Type::Boolean.new.cast('f') # => false | |
ActiveModel::Type::Boolean.new.cast('0') # => false | |
ActiveModel::Type::Boolean.new.cast('false') # => false | |
ActiveModel::Type::Boolean.new.cast(false) # => false | |
ActiveModel::Type::Boolean.new.cast(nil) # => nil |
# Start a new, one-off ruby container running a bash shell. It should have the | |
# current directory mounted at '/usr/src': | |
docker run --rm -ti -v $(pwd):/usr/src -w /usr/src ruby:2.2.6 bash | |
# Now that your'e running bash inside our one-off container, install rails and generate the app. | |
gem install rails --no-rdoc --no-ri && rails new my-app --database=postgresql | |
# Exit the one-off container. The container should be removed automatically. | |
exit |
import qrcode | |
import sqlite3 | |
conn = sqlite3.connect('databases') | |
c = conn.cursor() | |
for idx, (email, secret, issuer) in enumerate(c.execute("SELECT email,secret,issuer FROM accounts").fetchall()): | |
url = 'otpauth://totp/{}?secret={}&issuer={}'.format(email, secret, issuer) | |
print url | |
im = qrcode.make(url) | |
im.save('{}.png'.format(idx)) |
curl -fsSL https://gist.github.com/mislav/055441129184a1512bb5.txt | RUBY_CONFIGURE_OPTS="--disable-install-doc" PKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig rbenv install --patch 2.2.2 |
#!/bin/sh | |
git push origin master |
You can apply the patch as a 3-way merge: | |
git diff 13.1_dev sale_edit > patch.diff | |
git apply -3 patch.diff | |
It should bring up the conflict so that you can resolve manually. Or you could go with a one-liner, piping the patch to git-apply directly: | |
git diff 13.1_dev sale_edit | git apply -3 | |
To reverse the patch: | |
git diff 13.1_dev sale_edit | git apply -3 -R |
workers ENV.fetch('WEB_CONCURRENCY') { 2 }.to_i | |
threads_count = ENV.fetch('MAX_THREADS') { 5 }.to_i | |
threads threads_count, threads_count | |
rackup DefaultRackup | |
port ENV.fetch('PORT') { 3000 } | |
environment ENV.fetch('RACK_ENV') { 'development' } | |
preload_app! | |
on_worker_boot do |
gem install html2haml | |
for file in app/views/**/*.html.erb; do html2haml -e $file ${file%erb}haml && rm $file; done | |
gem install html2slim | |
for file in app/views/**/*.html.erb; do erb2slim $file ${file%erb}slim && rm $file; done |
find . -name \*.rb -exec perl -p -i -e 's/([^:]):(\w+)\s*=>/\1\2:/g' {} \; |