This file contains 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
ctrl-z | |
bg | |
touch /tmp/stdout | |
touch /tmp/stderr | |
gdb -p $! | |
# In GDB | |
p dup2(open("/tmp/stdout", 1), 1) | |
p dup2(open("/tmp/stderr", 1), 2) |
This file contains 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
# Include this in your .irbrc | |
def unbundled_require(gem) | |
if defined?(::Bundler) | |
spec_path = Dir.glob("#{Gem.dir}/specifications/#{gem}-*.gemspec").last | |
if spec_path.nil? | |
warn "Couldn't find #{gem}" | |
return | |
end | |
spec = Gem::Specification.load spec_path |
This file contains 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
location / { | |
if ($uri ~* "/assets/.*-(.*)\..*") { | |
expires max; | |
add_header Cache-Control public | |
add_header Etag $1; | |
} | |
} |
This file contains 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
#!/bin/zsh | |
function actual_path() { | |
if [ [ -z "$1" ] -a [ -d $1 ] ]; then | |
echo $(cd $1 && test `pwd` = `pwd -P`) | |
return 0 | |
else | |
return 1 | |
fi | |
} |
This file contains 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
$ vagrant up | |
Bringing machine 'default' up with 'vmware_fusion' provider... | |
==> default: Cloning VMware VM: 'hashicorp/precise64'. This can take some time... | |
==> default: Checking if box 'hashicorp/precise64' is up to date... | |
==> default: Skipping vmnet device verification, verify_vmnet is set to false. | |
==> default: Deleting the VM... | |
/Users/zaius/.vagrant.d/gems/gems/vagrant-vmware-fusion-4.0.6/lib/vagrant-vmware-fusion/action_farm.rb:784:in `hostonly_config': undefined method `+' for nil:NilClass (NoMethodError) | |
from /Users/zaius/.vagrant.d/gems/gems/vagrant-vmware-fusion-4.0.6/lib/vagrant-vmware-fusion/action_farm.rb:706:in `block in call' | |
from /Users/zaius/.vagrant.d/gems/gems/vagrant-vmware-fusion-4.0.6/lib/vagrant-vmware-fusion/action_farm.rb:699:in `each' | |
from /Users/zaius/.vagrant.d/gems/gems/vagrant-vmware-fusion-4.0.6/lib/vagrant-vmware-fusion/action_farm.rb:699:in `call' |
This file contains 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
App.Post = App.Model.extend App.RelationshipMixinFactory('comments'), | |
comments: DS.hasMany('comment', async: true) |
This file contains 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
# Put in config/initializers/handlebars.rb | |
# Add templates to app/assets/javascripts/templates/whatever.js.handlebars | |
# Then require from applicaiton.js (or any manifest) as usual. e.g. | |
# //= require_tree templates | |
class EmberHandlebars < Tilt::Template | |
def self.default_mime_type | |
'application/javascript' | |
end |
This file contains 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 | |
require 'curb' | |
require 'yaml' | |
hosts = %w( | |
example.com | |
google.com | |
) |
This file contains 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
# Remap prefix to ctrl-s - keeps ctrl-a free for start of line | |
set -g prefix C-s | |
unbind C-b | |
# Keep consistent with screen behavior | |
bind C-s last-window | |
bind C-d detach | |
bind C-c new-window | |
bind C-r source-file $HOME/.tmux.conf |
This file contains 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
#!/bin/sh | |
CERT_PATH=/usr/local/share/ca-certificates/verisign.crt | |
write_certs() { | |
cat > $1 <<EOF | |
-----BEGIN CERTIFICATE----- | |
MIICPDCCAaUCEDyRMcsf9tAbDpq40ES/Er4wDQYJKoZIhvcNAQEFBQAwXzELMAkG | |
A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz | |
cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2 |
NewerOlder