Skip to content

Instantly share code, notes, and snippets.

View scottjacobsen's full-sized avatar

Scott Jacobsen scottjacobsen

View GitHub Profile
@scottjacobsen
scottjacobsen / git+clone+ssh+agent+forward+sudo
Created December 14, 2012 00:07
Git clone using ssh agent forwarding and sudo
SSH agent forwarding is great. It allows you to ssh from one server to
another all the while using the ssh-agent running on your local
workstation. The benefit is you don't need to generate ssh key pairs
on the servers you are connecting to in order to hop around.
When you ssh to a remote machine the remote machine talks to your
local ssh-agent through the socket referenced by the SSH_AUTH_SOCK
environment variable.
So you the remote server you can do something like:
/((http:\/\/(.*youtube\.com\/watch.*|.*\.youtube\.com\/v\/.*|youtu\.be\/.*|.*\.youtube\.com\/user\/.*|.*\.youtube\.com\/.*#.*\/.*|m\.youtube\.com\/watch.*|m\.youtube\.com\/index.*|.*\.youtube\.com\/profile.*|.*\.youtube\.com\/view_play_list.*|.*\.youtube\.com\/playlist.*|www\.youtube\.com\/embed\/.*|.*twitch\.tv\/.*|.*twitch\.tv\/.*\/b\/.*|www\.ustream\.tv\/recorded\/.*|www\.ustream\.tv\/channel\/.*|www\.ustream\.tv\/.*|ustre\.am\/.*|qik\.com\/video\/.*|qik\.com\/.*|qik\.ly\/.*|.*revision3\.com\/.*|.*\.dailymotion\.com\/video\/.*|.*\.dailymotion\.com\/.*\/video\/.*|collegehumor\.com\/video:.*|collegehumor\.com\/video\/.*|www\.collegehumor\.com\/video:.*|www\.collegehumor\.com\/video\/.*|telly\.com\/.*|www\.telly\.com\/.*|break\.com\/.*\/.*|www\.break\.com\/.*\/.*|vids\.myspace\.com\/index\.cfm\?fuseaction=vids\.individual&videoid.*|www\.myspace\.com\/index\.cfm\?fuseaction=.*&videoid.*|www\.metacafe\.com\/watch\/.*|www\.metacafe\.com\/w\/.*|blip\.tv\/.*\/.*|.*\.blip\.tv\/.*\/.*|video\.google\.com\/videoplay\?
@scottjacobsen
scottjacobsen / benchmark.rb
Created August 6, 2021 19:43
to_money.format
[6] pry(main)> Benchmark.ips do |x|
[6] pry(main)* x.report("n2c") { number_to_currency(amount) }
[6] pry(main)* x.report("Money") { amount.to_money.format }
[6] pry(main)* x.compare!
[6] pry(main)* end
Warming up --------------------------------------
n2c 1.024k i/100ms
Money 2.076k i/100ms
Calculating --------------------------
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_DEFAULT_REGION: us-east-1
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
jobs:
rspec:
runs-on: ubuntu-16.04
steps:
- name: Restore bundle cache
@scottjacobsen
scottjacobsen / out.txt
Created June 3, 2020 00:12
ruby compile
>>> Installing ruby 2.6.6 into /Users/scott/.rubies/ruby-2.6.6 ...
>>> Installing dependencies for ruby 2.6.6 ...
>>> Downloading https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.6.tar.bz2 into /Users/scott/src ...
>>> Verifying ruby-2.6.6.tar.bz2 ...
>>> Extracting ruby-2.6.6.tar.bz2 to /Users/scott/src/ruby-2.6.6 ...
>>> Configuring ruby 2.6.6 ...
checking for ruby... /usr/bin/ruby
tool/config.guess already exists
tool/config.sub already exists
checking build system type... x86_64-apple-darwin19.4.0
@scottjacobsen
scottjacobsen / git-grep.el
Last active January 24, 2020 16:53
A more convenient git-grep. By default this will grep all files in the repository from the root of the git repository. I find these defaults more convenient than those used by vc-git-grep in the emacs version control library.
;; derived from rails-project:root from
;; https://github.com/remvee/emacs-rails
(defun git-root ()
"Return GIT_ROOT if this file is a part of a git repo,
else return nil"
(let ((curdir default-directory)
(max 10)
(found nil))
(while (and (not found) (> max 0))
(progn
cat << "EOF"
______ _ _ _ ______ _
| ___ \ (_) | | | | | ___| | |
| |_/ /_ __ _ __ _| |__ | |_ | |_ _ _ _ __ __| |___
| ___ \ '__| |/ _` | '_ \| __| | _| | | | '_ \ / _` / __|
| |_/ / | | | (_| | | | | |_ | | | |_| | | | | (_| \__ \
\____/|_| |_|\__, |_| |_|\__| \_| \__,_|_| |_|\__,_|___/
__/ |
|___/
EOF
@scottjacobsen
scottjacobsen / hsb.txt
Created November 8, 2012 22:46
holy shit bash!
The following paragraphs describe how bash executes
its startup files. If any of the files exist but
cannot be read, bash reports an error. Tildes are
expanded in file names as described below under
Tilde Expansion in the EXPANSION section.
When bash is invoked as an interactive login shell,
or as a non-interactive shell with the --login
option, it first reads and executes commands from
@scottjacobsen
scottjacobsen / anonymous-gist.
Created April 10, 2018 18:29
bundle_install
Fetching gem metadata from https://rubygems.org/..........
Fetching rake 12.3.1
Installing rake 12.3.1
Fetching concurrent-ruby 1.0.5
Installing concurrent-ruby 1.0.5
Fetching i18n 0.9.5
Installing i18n 0.9.5
Fetching minitest 5.11.3
Installing minitest 5.11.3
@scottjacobsen
scottjacobsen / anonymous-gist.
Created August 7, 2014 23:04
passenger-error
(staging-web) root@ip-10-0-1-132 /var/log/nginx# cat /tmp/passenger_native_support-rmfgcc.log
# mkdir -p /home/neighborland/.passenger/native_support/4.0.48/ruby-2.1.2-x86_64-linux-gnu
# cd /home/neighborland/.passenger/native_support/4.0.48/ruby-2.1.2-x86_64-linux-gnu
# /usr/bin/ruby2.1 /usr/share/passenger/ruby_extension_source/extconf.rb
checking for alloca.h... *** /usr/share/passenger/ruby_extension_source/extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options: