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
Generate a key: | |
openssl genrsa 2048 > <hostname>.key | |
Generate a CSR: | |
openssl req -new -key <hostname>.key -out <hostname>.csr | |
Generate a self-signed cert: | |
openssl req -new -x509 -nodes -days 365 -sha1 -key <hostname>.key > <hostname>.crt |
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
# https://speakerdeck.com/u/jeg2/p/10-things-you-didnt-know-ruby-could-do | |
RubyVM::InstructionSequence.compile_option = { :tailcall_optimization => true, | |
:trace_instruction => false } | |
eval <<end | |
def factorial(n, result = 1) | |
if n == 1 | |
result | |
else |
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
git merge --no-commit && git checkout other-branch -- . && git commit | |
### https://twitter.com/adymitruk/status/69479850846593024 | |
# We needed this once after some intense debugging on the staging branch. We knew | |
# staging was correct and wanted to merge staging -> production and be sure that | |
# prod branch never "won" any conflicts |
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
python -m smtpd -n -c DebuggingServer localhost:1026 |
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
# Here's an idiom to spawn a subprocess and capture its output, without fear of | |
# being attacked by shell metachars | |
# (Perl's backtick operator spawns a shell) | |
sub safeticks { | |
my $retval = ''; | |
my $line; | |
my $pid; | |
die "Can't fork: $!" unless defined($pid = open(KID, "-|")); | |
if ($pid) { # parent |