Skip to content

Instantly share code, notes, and snippets.

@hummus
hummus / gist:8538023
Created January 21, 2014 10:59
ssh throughput oneliner
ssh hostname 'openssl enc -aes-256-ctr -pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" -nosalt < /dev/zero' | pv > /dev/null
@hummus
hummus / README
Created December 23, 2013 07:48 — forked from sasha-id/README
MongoDB upstart scripts for Ubuntu.
Run following commands after installing upstart scripts:
ln -s /lib/init/upstart-job /etc/init.d/mongoconf
ln -s /lib/init/upstart-job /etc/init.d/mongodb
ln -s /lib/init/upstart-job /etc/init.d/mongos
To start services use:
@hummus
hummus / gist:7889036
Last active December 30, 2015 21:39 — forked from somic/gist:123889
#!/bin/bash
# Prints out how many seconds ago this EC2 instance was started
# It uses Last-Modified header returned by EC2 metadata web service, which as far
# as I know is not documented, and hence I assume there is no guarantee
# that Last-Modified will be always set correctly.
# if this fails for some non-ec2 instance, then
# try to stat a file that might be from os-install time
# Use at your own risk.
python <<EOP
from datetime import datetime;import urllib2;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
body {
font: 14px sans-serif;
}
.axis path, .axis line {
fill: none;
@hummus
hummus / gist:5682969
Created May 31, 2013 04:38
mysql: quick drop all foreign key constraints
mysql -u $USER -p$PASS -e 'select * from information_schema.TABLE_CONSTRAINTS where CONSTRAINT_TYPE="FOREIGN KEY"' -B | awk '{if (NR!=1) print("ALTER TABLE "$2"."$5" DROP FOREIGN KEY "$3";")}' | mysql -u $USER -p$PASS