Skip to content

Instantly share code, notes, and snippets.

@didip
didip / brew-update-force.sh
Created August 21, 2015 05:56
Force brew update
cd `brew --prefix`
git remote add origin https://github.com/mxcl/homebrew.git
git fetch origin
git reset --hard origin/master
@didip
didip / gist:d46e0e6d9931a927e254
Created August 27, 2014 21:49
Removing container through remote API raise "Device is busy" error, but based on the underlying mount, the SHA directory is actually deleted.
> docker version
Client version: 1.1.2
Client API version: 1.13
Go version (client): go1.2.2
Git commit (client): d84a070/1.1.2
Server version: 1.1.2
Server API version: 1.13
Go version (server): go1.2.2
Git commit (server): d84a070/1.1.2
@didip
didip / docker-builder.sh
Last active May 7, 2022 19:42
Small helper script that automates Docker building and pushing
#!/bin/bash
set -ex
PARENT_DIR=$(basename "${PWD%/*}")
CURRENT_DIR="${PWD##*/}"
IMAGE_NAME="$PARENT_DIR/$CURRENT_DIR"
TAG="${1}"
REGISTRY="hub.docker.com"
#!/bin/sh
PORT=4200
sudo launchctl unload /Library/LaunchDaemons/com.crashplan.engine.plist
sudo sed -i '' "s/\(<servicePort>\)[^<]*/\1$PORT/" /Library/Application\ Support/CrashPlan/conf/my.service.xml
sed -i '' "s/#*\(servicePort=\).*/\1$PORT/" /Applications/CrashPlan.app/Contents/Resources/Java/conf/ui.properties
defaults write /Applications/CrashPlan.app/Contents/Resources/CrashPlan\ menu\ bar.app/Contents/Info CPPort $PORT
sudo launchctl load /Library/LaunchDaemons/com.crashplan.engine.plist
#!/usr/bin/env python
from selenium import webdriver
baseurl = "http://staging-v2.postano.com/login"
username = "didip"
password = "baz"
mydriver = webdriver.Firefox()
mydriver.get(baseurl)
begin;
insert into table select * from only table where id between 1 and 10000000;
delete from only table where id between 1 and 10000000;
commit;
begin;
insert into table select * from only table where id between 10000001 and 20000000;
delete from only table where id between 10000001 and 20000000;
commit;
@didip
didip / setup-remi-repo.sh
Created June 28, 2013 00:27
Remi's Repo. God send for CentOS 6.4
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
@didip
didip / generic-dot-profile
Created May 8, 2013 05:22
My generic .profile file
# say
alias say="say -v Vicki"
# Don't check mail
unset MAILCHECK
#
# Fancy bash functions
#
function ifconfig_line {
@didip
didip / setup-multiple-venvs.sh
Last active December 16, 2015 01:39
Setup multiple virtualenvs using pythonz.
#!/bin/bash
#
# Setup multiple Pythons for On the Plates
#
# VARIABLES
PYTHON27_VERSION='2.7.4'
PYTHON27_NAME="CPython-$PYTHON27_VERSION"
PYTHON27_BIN="~/.pythonz/pythons/$PYTHON27_NAME/bin/python"
@didip
didip / stathat-https-embed.js
Last active December 14, 2015 22:29
StatHat HTTPS embed.js
StatHatEmbed=new function(){function d(){var a=document.getElementsByTagName("script");return a[a.length-1]}function e(a,b){var d=document.createElement("script"),c="//www.stathat.com/embed/"+a+"/"+b.s1;b.dev&&(c="//localhost:8081/embed/"+a+"/"+b.s1);b.s2&&(c+="/"+b.s2);b.s3&&(c+="/"+b.s3);c+="?w="+b.w+"&h="+b.h+"&tf="+b.tf;b.style&&(c+="&style="+b.style);b.dev&&(c+="&dev=1");b.title&&(c+="&title="+b.title);d.src=c;d.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(d)}
function f(a){return[a.s1,a.s2,a.s3,a.w,a.h,a.tf,a.style].join("_")}this.render_graph=function(a){DIV_ID="statd_embed_graph_"+f(a);d().insertAdjacentHTML("AfterEnd","<div id='"+DIV_ID+"' style='display:none'></div>");e("graph",a)};this.render_data=function(a){DIV_ID="statd_embed_data_"+f(a);d().insertAdjacentHTML("AfterEnd","<div id='"+DIV_ID+"' style='display:none'></div>");e("data",a)};this.render_table=function(a){DIV_ID="statd_embed_table_"+f(a);d().insertAdjacentHTML("AfterEnd","<div id='"+DIV_ID+
"' style='displ