Skip to content

Instantly share code, notes, and snippets.

@sbimikesmullin
sbimikesmullin / 1-bulk-copy-ssh-key.sh
Last active December 16, 2015 23:08
bulk copy ssh key without prompts
echo "StrictHostKeyChecking no" > ~/.ssh/config
sshpass -p aU7Gra7uZX9P ssh-copy-id root@166.78.238.8
# ...
rm ~/.ssh/config
@sbimikesmullin
sbimikesmullin / gist:5860909
Created June 25, 2013 18:17
gzip and swap test
# match media01
sudo sysctl vm.swappiness=0
sudo echo 2 > /proc/sys/vm/overcommit_memory
sudo echo 50 > /proc/sys/vm/overcommit_ratio
vim /memtest.sh
#!/bin/bash
D=/tmp/$1
mkdir $D
mount -ttmpfs $D $D # by default is sized to half of physical memory
@sbimikesmullin
sbimikesmullin / piper.coffee
Last active March 3, 2018 23:41
interpret stdin and output reports periodically throughout the stream
counters = {}
process.stdin.resume()
process.stdin.setEncoding('utf8')
process.stdin.on 'data', (chunk) ->
if (matches = `/ \[3\] \[ (.+?) \]: (\w+) cmd=(\w+)/`.exec(''+chunk)) isnt null
[ nil, cla, type, cmd ] = matches
counters["#{cla}:#{type}:#{cmd}"] ||= 0
counters["#{cla}:#{type}:#{cmd}"] += 1
#process.stdout.write chunk
@sbimikesmullin
sbimikesmullin / Makefile
Created July 25, 2013 19:21
ANSI C (linux x86) tcp socket client connect load tester
all:
gcc client.c -o client

example gfm task list

  • task one
  • task number two
  • blah blah blah

asdfasdf

@sbimikesmullin
sbimikesmullin / tsc-filter.coffee
Created September 14, 2013 06:07
a filter that reformats the output of the TypeScript compiler e.g., `tsc -w *.ts --out /dev/null | coffee filter.coffee` so that it is more useful including source excerpts and little ansi colored arrows pointing to char, similar to the coffeescript compiler
path = require 'path'
fs = require 'fs'
repeat = (s, n) -> r=''; r+=s while --n >= 0; r
process.stdin.setEncoding 'utf8'
process.stdin.resume()
buf = ''
parse = undefined
process.stdin.on 'data', (data) ->
@sbimikesmullin
sbimikesmullin / mdadm_undo.sh
Created December 3, 2013 22:01
mdadm: undo a software raid
sudo fdisk -l # Find out your arrays (md0, md1, etc..)
sudo mdadm --detail /dev/md0 # Query your arrays to find out what disks are contained using
sudo umount /backup # unmount all partitions on that drive
sudo mdadm --stop /dev/md0 # Shut down the array
sudo mdadm --zero-superblock /dev/xvdc /dev/xvdd /dev/xvde # zero the superblock FOR EACH drive
@sbimikesmullin
sbimikesmullin / gist:7794560
Created December 4, 2013 20:06
intro to njs for rubyist
more accurate comparisons:
* coffeescript to ruby
* express to sinatra
* towerjs to rails
think of node.js as a thin wrapper gluing together google's v8 engine (this is the runtime interpreter of javascript and also the virtual machine), and libuv (this is the secret sauce to asynchronous input-output; it is a C project largely maintained by Joyent for Node.JS but was recently adopted by Ruby, as well). the whole point of it is to take javascript beyond the browser by giving it direct access to the operating system input output systems. making it able to be much more powerful.
things unique to node:
* continuation-passing style callbacks; proving to be one of the most effective methods of managing asynchronous concurrency challenges.
* perhaps the most efficient event loop implementation; can do more with one core than most apps can do with several.
@sbimikesmullin
sbimikesmullin / netbeans_dark_theme_6.9.1.txt
Last active August 29, 2015 13:55
Dark Theme for NetBeans
http://blog.mknsoft.com/?p=104
http://nilogonzalez.es/nimrodlf/download-en.html
http://nilogonzalez.es/nimrodlf/faq-en.html#10
#!/usr/bin/env bash
/opt/netbeans-6.9.1/bin/netbeans \
-J-Dnimrodlf.themeFile=/opt/netbeans-6.9.1/mynbtheme/Night.theme \
-cp:p /opt/netbeans-6.9.1/mynbtheme/nimrodlf-1.2a.jar \
--laf com.nilo.plaf.nimrod.NimRODLookAndFeel \
;
@sbimikesmullin
sbimikesmullin / update_certificate_authority.sh
Created February 25, 2014 18:09
# update CyberSource Certificate Authority files on Ubuntu
# update CyberSource Certificate Authority files on Ubuntu
cd /tmp
wget https://support.cybersource.com/library/KB/CYBERSOURCE/downloads/Entrust_2014.zip
unzip Entrust_2014.zip
cd Entrust_2014
openssl verify ics2ws.ic3.com.crt
cat *.crt >> /etc/pki/tls/certs/ca-bundle.crt
openssl verify ics2ws.ic3.com.crt
cd ..