Skip to content

Instantly share code, notes, and snippets.

View johndpope's full-sized avatar

John D. Pope johndpope

View GitHub Profile
@adilsoncarvalho
adilsoncarvalho / all-to-mp3.sh
Created July 9, 2011 02:08
Script to convert CAF files to MP3
#!/bin/sh
#
# a script to convert every CAF sound file in the current
# directory to a corresponding AIF sound file.
#
# author: alvin alexander, devdaily.com
#
# This work is licensed under the Creative Commons Attribution-Share Alike 3.0
# United States License: http://creativecommons.org/licenses/by-sa/3.0/us/
@datagrok
datagrok / gist:2199506
Last active April 8, 2023 17:36
Virtualenv's `bin/activate` is Doing It Wrong
@akumria
akumria / find-forks.py
Last active March 9, 2024 01:39
A quick way to find all the forks of a particular github project. see: https://github.com/akumria/findforks for a version which works now
#!/usr/bin/env python
import os
import urllib2
import json
import subprocess
user=None
repo=None
@Fat-Zer
Fat-Zer / autotools-cmake-convert.pl
Last active March 29, 2020 02:51
autotools-cmake-convert.pl
#!/usr/bin/env perl
# Usage sample:
# find <dir> -iname Makefile.am | while read m; do
# echo "=== processing $m ===";
# ../scripts/autotools-cmake-convert.pl ${m} >"$(dirname $m)/CMakeLists.txt";
# done
use v5.10.1;
use experimental qw(smartmatch);
use File::Basename;
@wm
wm / Powerline.md
Last active September 6, 2022 00:55
Installing powerline on Mac OSX. The following was done in version Version 10.8.2

Install dependencies

brew install cmake
brew install python
sudo easy_install pip

Add powerline bin to your path. In your zshrc file (or the paths files sourced in zshrc) add the following line

PATH="/usr/local/share/python/:$PATH"

Reinstall MacVim with brew

@phette23
phette23 / current-dir-in-iterm-tab-title.sh
Last active January 4, 2024 10:20
Set the iTerm tab title to the current directory, not full path.
# put this in your .bash_profile
if [ $ITERM_SESSION_ID ]; then
export PROMPT_COMMAND='echo -ne "\033];${PWD##*/}\007"; ':"$PROMPT_COMMAND";
fi
# Piece-by-Piece Explanation:
# the if condition makes sure we only screw with $PROMPT_COMMAND if we're in an iTerm environment
# iTerm happens to give each session a unique $ITERM_SESSION_ID we can use, $ITERM_PROFILE is an option too
# the $PROMPT_COMMAND environment variable is executed every time a command is run
# see: ss64.com/bash/syntax-prompt.html
@jvperrin
jvperrin / routes.rb
Created July 14, 2013 05:16
Route ordering oddity in Rails 4
# This ordering will not work:
resources :posts, :except => :index
get "/posts" => "posts#index", :as => :posts
# This ordering will work:
get "/posts" => "posts#index", :as => :posts
resources :posts, :except => :index
# Both work, however, in Rails 3.2.13.
@adammathes
adammathes / generate_clut.py
Created August 17, 2013 19:07
Given an input image color palette, extracts all colors from it and generates a color lookup table texture suitable for use with GPUImageLookupFilter of using closest color logic.
#!/usr/bin/python
from PIL import Image, ImageColor
import math
import sys
def closest_color(incolor, colors):
distances = []
min_distance = 10000
for color in colors:
@vishwasbabu
vishwasbabu / gist:6433127
Last active October 11, 2016 17:52
MySQL Commands
--Enable MySQL General Log
SET global general_log = 1;
SET global log_output = 'table';
--MySQL Dump
mysqldump -uroot -ppassword dbname > dump.sql
--enable access from a particular system
GRANT ALL PRIVILEGES ON *.* TO root@106.51.132.21 identified by "password"
@deathcult
deathcult / mysql_kill_sleep_proc.sh
Last active October 11, 2016 17:53
kill mysql sleep process
#!/bin/sh
## MySQL 5.1.61
## sleep时间大于等于10秒,kill掉:
mysqladmin -u* -p* processlist |grep -i sleep |awk '{if($12>=10) print $2}' |xargs -n1 mysqladmin -u* -p* kill