Skip to content

Instantly share code, notes, and snippets.

%%==============================================================================================
%% figuring out the best way to catch a gen_server call, when process group ceases to exist
%%
%% until i figure out why it disappears,i want to catch the current gen call arg's .so IMHO options are
%% ( i) recreate the group in the Else, and redo the call
%% OR
%% (ii) crash wih prev state and redo it somehow (not sure of how but i htink ive seen this being done)
%%
%% -b101
%%==============================================================================================
@bosky101
bosky101 / git-completion-addons.bash
Created May 5, 2012 06:00
Place this in your .bash_profile for git-completion
#
# Command line prompt addon, to autocomplete git commands & branches
# as well as show current branch. It is especially useful since it modifies
# the terminal prompt & uses colors to distinguish if master is dirty
# or the working directory is up to date
#
# Step 1
# get git-completion.bash from any git repo
# https://raw.github.com/git/git/master/contrib/completion/git-completion.bash
- (void)logDebugMessage:(NSString *)message
{
if (DEBUG_LOG)
{
message = [NSString stringWithFormat:@"LOG: %@ \n", message];
NSLog(@"%@", message);
}
}
@bosky101
bosky101 / .gitconfig
Last active September 16, 2023 07:49
$ git pause <file>
# git pause <file>
# Stops tracking <file> if already in the repo
# Have SomeHeader.h that changes on every developers machine ?
# Want it in the repo, got still want the magic of .gitignore on the file ?
# easy
# git pause SomeHeader.h
# making changes to SomeHeader.h wont be staged, wont show in diff or status. perfect!
@bosky101
bosky101 / test_ssl.erl
Last active December 18, 2015 20:59
Testing a simple https get request. R16A, R16B,R16B01 seems to fail, while for the same configuration R15B03 works. Change USE_VERIFY_PEER, ?USE_SSL_TIMEOUT, and location of ?home, ?CERT,?KEY,?CA accordingly while testing ~@bhaskerkode, Last updated: June 25, 2013
-module(test_ssl).
-author('Bhasker Kode').
-compile([export_all]).
-define(USE_ACCEPT_TIMEOUT,false). %% ssl:ssl_accept is passed a timeout
-define(USE_VERIFY_PEER,false). %% ssl:listen is passed {verify,verify_peer}
%% R15B02 => Works with/without ?USE_VERIFY_PEER Fails when ?USE_SSL_TIMEOUT
%% R15B03 => Works with/without ?USE_VERIFY_PEER Fails when ?USE_SSL_TIMEOUT
%% R16A => Fails* with/without ?USE_VERIFY_PEER Fails with/without ?USE_SSL_TIMEOUT
@bosky101
bosky101 / customersalsobought-bookmark.txt
Last active December 19, 2015 15:09
Reached an iTunes page and want to know where iTunes recommends it to users? Create a new bookmark on your browser toolbar, with the location as follows.
javascript:(function(){ var meta=document.getElementsByTagName('meta')[1].getAttribute('content').split(','); var q = '"Customers also bought." '+meta[0] +' ·' + meta[2] + '; "View in iTunes." site:itunes.apple.com inurl:"/us/"'; window.location.href = 'https://google.com/search?q='+encodeURIComponent(q);})();
@bosky101
bosky101 / gist:6625584
Created September 19, 2013 15:56
eg of pushing to a private docker repo
$ docker ps
ID IMAGE COMMAND CREATED STATUS PORTS
2dd6ee092e87 verbs/statsdwithl:latest node /statsd-0.6.0/s 3 weeks ago Up 3 weeks XXX->8125/udp, XXX->8126
e71f9a45e648 lonewolf/graphite:latest /bin/sh /usr/local/b 3 weeks ago Ghost XXX->2003, XXX->8000
$ docker commit 2dd6ee092e87 verbsbackup/statsd
7ff742b1ec9e
$ docker images
REPOSITORY TAG ID CREATED SIZE
@bosky101
bosky101 / jswarrior
Created September 26, 2013 07:14
jswarrior level5 crossed, with this . more at http://jswarrior.fusioncharts.com
jsWarrior.turn = function(warrior) {
if(warrior.check() == "enemy") {
warrior.enemies=(warrior.enemies)?warrior.enemies+1:1;
if(!warrior.fighting){warrior.fighting++;}else{ warrior.tired++;}
warrior.attack();
}
else {
if(warrior.check() == "diamond") {
warrior.collect();
}else{
@bosky101
bosky101 / stress-docker-run
Last active December 25, 2015 21:19
stress testing the creation of a 1000 docker containers, comes across file descriptor and iptable errors
[] ubuntu@~$ sudo docker version
Client version: 0.6.3
Go version (client): go1.1.2
Git commit (client): b0a49a3
Server version: 0.6.3
Git commit (server): b0a49a3
Go version (server): go1.1.2
Last stable version: 0.6.4, please update docker
[] ubuntu@~$ ulimit -a
@bosky101
bosky101 / benchmark.sh
Last active August 29, 2015 13:58 — forked from emersonmoretto/benchmark.sh
benchmark a bunch of urls with POST and plot them in the same graph as points
#!/bin/bash
echo -e "\nbenchmark.sh <title> -n<number of requests> -c<number of concurrency> <URL1> <URL2> ..."
echo -e "\nEx: benchmark.sh example -n100 -c10 http://www.google.com/ http://www.bing.com/ will create benchmar-example-n100-c10.png\n"
## Gnuplot settings
echo "set terminal png
set output 'benchmark-${1}${2}${3}.png'
set title 'Benchmark: ${1} with ab ${2} ${3}'