Skip to content

Instantly share code, notes, and snippets.

@rghose
rghose / stackshot.sh
Created July 18, 2017 14:12
Generate stack trace of a running process on OS X
# Written by Cheng Zhao(zcbenz@gmail.com).
# Published under Public Domain.
# Usage: stackshot.sh pid
# Path to stackshot tool.
STACKSHOT='/usr/libexec/stackshot'
# Path to symbolicated report.
TRACEFILE='/Library/Logs/stackshot-syms.log'
#!/bin/bash
#
# Sorts songs of an FILE_TYPE and places them into appropriate folders
# where artist name is separated by SEPARATOR
#
# Also counts the total files copied.
#
# (C) Mirage 2017
#
FILE_TYPE=mp3
#!/bin/bash
website="http://chromedriver.storage.googleapis.com"
version=$(curl "$website/LATEST_RELEASE")
os_name="unknown"
if [ "$(uname)" == "Darwin" ]; then
os_name="mac64";
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
os_name="linux32";
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then
os_name="win32"
@rghose
rghose / file
Created September 26, 2016 08:22
freedom_public
{"0.7613954245246981":"-----BEGIN PGP PUBLIC KEY BLOCK-----\r\nCharset: UTF-8\r\n\r\nxv8AAABSBAAAAAATCCqGSM49AwEHAgMEoPposVDI0RVlKyjBqBjuUpEs6NT6OPgJ\r\nanUGW5JOHj3d0nc6HdiZmgQSCeLTzIX/45oGr4K0vELOtQXn8IUZKc3/AAAACDxn\r\naXRodWI+wv8AAACOBBATCABA/wAAAAWCV+ja4v8AAAACiwn/AAAACZDsHYJd/Dcc\r\nCv8AAAAFlQgJCgv/AAAABJYDAQL/AAAAApsD/wAAAAKeAQAAbkMBAJ8XUP0n2TFM\r\nrgNcKpCVTwJ9YIApJf/2B/tVoCGIPTN1AP9EUCCPi+UagnYYDl8mXxj5ePqBYBnb\r\nHQgrizQHszKfMM7/AAAAVgQAAAAAEggqhkjOPQMBBwIDBJmlA986fb7VQoDF+I9o\r\nO40BVJxNhUDKVRLtUzvkRGx8G1XLK8iW32svirA0VgrsDUV7T3+kxjOm3gtvzujU\r\nibIDAQgHwv8AAABtBBgTCAAf/wAAAAWCV+ja4v8AAAAJkOwdgl38NxwK/wAAAAKb\r\nDAAAQZ8BAIZoTcNfwrjgi6iSIWpUD+4PrbxoZcwt3VujjagFCDRjAP4uggmy+qhZ\r\nWl/6X3lGoEGO5xMVLlEQvKXXbllNSWdmUw==\r\n=qZZ4\r\n-----END PGP PUBLIC KEY BLOCK-----\r\n"}
ActiveRecord::AdapterNotSpecified: database configuration does not specify adapter
from /mnt/deploy/spacely/shared/bundle/ruby/2.1.0/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_specification.rb:47:in `resolve_hash_connection'
[6] pry(main)> Passenger.connection
ActiveRecord::AdapterNotSpecified: database configuration does not specify adapter
from /mnt/deploy/spacely/shared/bundle/ruby/2.1.0/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_specification.rb:47:in `resolve_hash_connection'
@rghose
rghose / parse_names.sh
Created November 2, 2014 09:15
Parse names from the list
#!/bin/sh
fileName=$1
for c in $(cat $fileName); do
path=$(echo $c | grep '/wiki/' | sed 's/href="//' | sed 's/"//')
if [ ! -z $path ] ; then
python python_parser.py http://en.wikipedia.org$path;
fi;
done
@rghose
rghose / python_parse.py
Created November 2, 2014 09:12
Get wiki image
#!python
import sys
import urllib2
from HTMLParser import HTMLParser
def download_file(url,fName):
fName = "./images/"+fName
req = urllib2.urlopen(url)
CHUNK = 16 * 1024
with open(fName, 'wb') as fp:
@rghose
rghose / install_opencv2.4.8.sh
Last active August 29, 2015 14:00 — forked from mitmul/install_opencv2.4.8.sh
This will make opencv
#! /bin/bash
sudo yum install -y gcc g++ gtk+-devel libjpeg-devel libtiff-devel jasper-devel libpng-devel zlib-devel cmake unzip
sudo yum install -y yum-priorities
wget http://ftp-srv2.kddilabs.jp/Linux/distributions/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo rpm -ivh epel-release-6-8.noarch.rpm
sudo yum install -y eigen3-devel —enablerepo=epel
pip install numpy
wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.8/opencv-2.4.8.zip
unzip opencv-2.4.8
@rghose
rghose / gitstat.sh
Created April 2, 2014 13:49
Git commit statistics
#!/bin/bash
git log | grep Author | awk -F: '{count[$2]++;} END {for (c in count) { print count[c], c; } }' | sort -n
#!/bin/sh
set -e
# Get a list of groups a user is a member of on one line, space-seperated
# Single-quote group names with spaces, otherwise print the rest
SPACE_CHAR='-'
TMP=`mktemp`
hostname=""
baseDN=""