Skip to content

Instantly share code, notes, and snippets.

module Ext
class Protocol
def initialize(meths, dispatch={})
@dispatch = dispatch
@meths = meths
end
def adapt(obj)
w = obj.class.ancestors.detect do |klass|
@dispatch[klass]
@sergueif
sergueif / domains.rb
Created May 5, 2014 00:25
All domains visited by Chrome
#some bash first
#Get Chrome history file here: http://www.chromium.org/user-experience/user-data-directory
#sqlite3 /PATH/TO/History "select datetime(last_visit_time/1000000-11644473600,'unixepoch'),url from urls order by last_visit_time desc" > history_export.txt
f = File.open('./history_export.txt')
e = f.each_line.lazy.map do |l|
next if l =~ /\|file:/
next if l =~ /\|chrome-extension:/
next if l =~ /\|mailto:/
@sergueif
sergueif / recreate.sh
Last active August 29, 2015 14:11
Bosh lite recreate
#/bin/bash -e
start=`date +%s`
stemcell="bosh-stemcell-389-warden-boshlite-ubuntu-trusty-go_agent.tgz"
vagrant destroy --force
vagrant up --provider=virtualbox
bosh -t 192.168.50.4 login <<HERE
admin
admin
HERE
bin/add-route
@sergueif
sergueif / deploy_cf.sh
Last active August 29, 2015 14:11
Deploy current folder to bosh director
#/bin/bash -e -x
start=`date +%s`
bosh-lite/make_manifest && bosh -n create release --force && bosh -n upload release --rebase && bosh -n deploy
endd=`date +%s`
diff=`bc < <(echo "($endd - $start)/60")`
echo "took $diff to push cf source to the bosh director"
#if first deploy
start=`date +%s`
@sergueif
sergueif / jazz.md
Last active August 29, 2015 14:11
Jazz Wisdom

Wisdom I learned from jazz musicians

  • You don't find time. You make time.
  • Practice the way you gonna perform
  • "Its not the shit that you play. It's the shit you don't play." - Miles Davis
@sergueif
sergueif / gist:da5607339024629e55f9
Last active August 29, 2015 14:14
target bosh lite cf
cf logout
cf api api.10.244.0.34.xip.io --skip-ssl-validation
cf auth admin admin
cf co test1
cf target -o test1
cf create-space test1
cf target -o test1 -s test1
@sergueif
sergueif / gist:44a379ede9b1d0bd6407
Created February 9, 2015 23:16
Creating more space on the mac
bosh cleanup
recreate bosh-lite
delete boot2docker
#metron_agen.json
{
"EtcdUrls": ["http://10.244.0.42:4001"],
"EtcdMaxConcurrentRequests": 10,
"SharedSecret": "PLACEHOLDER-LOGGREGATOR-SECRET",
"LegacyIncomingMessagesPort": 3456,
"DropsondeIncomingMessagesPort": 3457,
"Index": 0,
"Job": "routing_api_z1",
"VarzUser": "",
@sergueif
sergueif / Dockerfile
Created July 16, 2015 13:11
Dockerfile for ruby-rails-sample from heroku
FROM ubuntu:14.04
@sergueif
sergueif / README
Created September 15, 2009 00:58
local-changes.rb finds all the git repositories it can with "locate" command and checks if you forgot to commit something.
Use this script to find local git repos where you have something uncommitted.
The script searches your hard-drive for repos using the unix "locate" command. To check which directories locate might skip see /etc/updatedb.conf
PRUNEPATHS variable lists directories which are skipped, so remove folders to include them in search.
For more info, run "man locate" and "man updatedb"