Skip to content

Instantly share code, notes, and snippets.

View alonisser's full-sized avatar

Alonisser alonisser

View GitHub Profile
@doctyper
doctyper / desaturate.js
Created May 26, 2011 01:03
desaturate canvas image
// Usage:
// var ctx = canvas.getContext("2d");
// var data = desaturate(ctx);
// ctx.putImageData(data);
var desaturate = function (ctx) {
var imgData = ctx.getImageData(0, 0, dimension, dimension);
for (y = 0; y < dimension; y++) {
for (x = 0; x < dimension; x++) {
@tsabat
tsabat / zsh.md
Last active December 25, 2023 19:16
Getting oh-my-zsh to work in Ubuntu
def run_pg_fouine():
info = host_info[env.host_string]
db_name = info.tags.get('Name')
sudo('perl -pi -e "s/log_min_duration_statement = .*/log_min_duration_statement = 0/" /etc/postgresql/9.*/main/postgresql.conf')
sudo('/etc/init.d/postgresql reload')
time.sleep(30)
sudo('perl -pi -e "s/log_min_duration_statement = .*/log_min_duration_statement = 500/" /etc/postgresql/9.*/main/postgresql.conf')
sudo('/etc/init.d/postgresql reload')
run('tail -n 100000 /var/log/postgresql/postgresql-9.*-main.log > /tmp/pgfouine.txt')
run('gzip -f /tmp/pgfouine.txt')
@pcdinh
pcdinh / easy_install and MinGW
Created April 15, 2012 10:53 — forked from mmlin/easy_install and MinGW
Installing hg-git on Windows using MinGW
Here's how I installed hg-git on Windows using the MinGW compiler.
PREPARE
-------
- Install Python (http://www.activestate.com/activepython/downloads)
- Install the Python package manager, setuptools (http://pypi.python.org/pypi/setuptools)
- Install the MinGW installer (http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get/)
- Install the C compiler, MinGW gcc, and a utility, pexports, to help create the import library
@phred
phred / pedantically_commented_playbook.yml
Last active November 3, 2023 01:55
Very complete Ansible playbook, showing off all the options
---
####
#### THIS IS OLD AND OUTDATED
#### LIKE, ANSIBLE 1.0 OLD.
####
#### PROBABLY HIT UP https://docs.ansible.com MY DUDES
####
#### IF IT BREAKS I'M JUST SOME GUY WITH
#### A DOG, OK, SORRY
####
@fancyremarker
fancyremarker / .bash_login.jenkins
Last active March 6, 2023 19:21
[A.] Scripts related to Jenkins client setup
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
@sidharthkuruvila
sidharthkuruvila / gist:3154845
Created July 21, 2012 06:30
Utility to functions to convert between camel case and underscore separated names
/**
* Takes a camel cased identifier name and returns an underscore separated
* name
*
* Example:
* camelToUnderscores("thisIsA1Test") == "this_is_a_1_test"
*/
def camelToUnderscores(name: String) = "[A-Z\\d]".r.replaceAllIn(name, {m =>
"_" + m.group(0).toLowerCase()
})
@chrislkeller
chrislkeller / README.md
Last active February 3, 2022 08:02
Displaying data from a flat JSON file on a Handlebars.js template file rendered with AJAX.

Demo: ajax-handlebars

This repo's location has changed.

@bergantine
bergantine / gist:3870080
Last active February 18, 2016 12:57
post-merge Git hook to install requirements if changed, compile stylesheets, syncdb, run a south migration on the database, and rebuild the haystack index using the active virtual environment's python installation. #bash #git #hook #django #compass #sass #pip #south #haystack
#!/bin/sh
if [ $(git diff HEAD@{1} HEAD --name-only | grep 'requirements/development.txt' -c) -ne 0 ]
then
sudo $VIRTUAL_ENV/bin/pip install -r /vagrant/myproject/requirements/development.txt
fi
compass compile /vagrant/myproject/myproject/static_media/stylesheets -e production --force
$VIRTUAL_ENV/bin/python /vagrant/myproject/manage.py syncdb
{
"directory": "components"
}