Skip to content

Instantly share code, notes, and snippets.

@resting
resting / gist:4212792
Created December 5, 2012 06:00
All exec commands in folder
// Shows all exec commands and dump into allexeccommands.txt
grep -rin 'exec(' var/www/yourfolder/ | awk '{FS=": +|\t"};{print $1;for(i=2;i<=NF;i++){ if($i != "") print $i}; print "\n"}' > allexeccommands.txt
@resting
resting / gist:4249028
Created December 10, 2012 07:24
Simple Mongo benchmark test
#include <mongo.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
int main () {
/**
Sample BSON object that we'll be injecting.
@resting
resting / gist:4256202
Created December 11, 2012 05:50
Simple Redis benchmark
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <time.h>
#include <hiredis.h>
#include <async.h>
int main() {
redisContext *c = redisConnect("127.0.0.1", 6379);
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
wget -q -O - https://raw.github.com/gist/2204072/install_tmux_1.6_on_ubuntu_10.04.sh | sudo bash
@resting
resting / .tmux.conf
Created January 29, 2013 00:57
My must have basic tmux config
set-option -g mouse-select-pane on
setw -g mode-keys vi
set -g history-limit 5000
setw -g utf8 on
@resting
resting / gist:4974757
Last active December 13, 2015 21:08
Simple mongo read time test
<?php
$m = new MongoClient();
$db = $m->selectDB("test");
$collection = new MongoCollection($db, "fakestat");
for($i=0;$i<1000;$i++){
$index[]=rand(1,432050);
}
$fp = fopen('logTime.txt','w');
fwrite($fp, "startTimeSec\t startTimeNanoSec\t endTimeSec\t endTimeNanoSec\n");
#!/usr/bin/env bash
export TMUX_INSTALL_VERSION=1.6
wget -q -O - "https://gist.github.com/raw/4561674/install_tmux_${TMUX_INSTALL_VERSION}_on_ubuntu_10.04.sh" | sudo bash