Skip to content

Instantly share code, notes, and snippets.


Alonisser alonisser

View GitHub Profile
View nginx-dashboard.json
"title": "Nginx Web",
"services": {
"query": {
"list": {
"0": {
"query": "response:[200 TO 299]",
"alias": "OK",
"color": "#7EB26D",
"id": 0,
alonisser / Installation
Last active Aug 29, 2015
Ansible role for setting cloudwatch reporting script on ubuntu servers
View Installation
sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update
sudo apt-get install ansible
mkdir automation && cd automation
touch ansible.cfg && hosts
mkdir -pv roles/aws_monitoring/tasks/main.yml
alonisser / postgres_connections
Last active Nov 27, 2015
Finding the postgres connections hog
View postgres_connections
#Broken somehow. need to fix
SELECT COUNT(*) as datname, datname, datid FROM pg_stat_activity GROUP BY datname;
#Works without id
SELECT COUNT(*) as datname, datname FROM pg_stat_activity GROUP BY datname;
More info:
alonisser / unicode csv reader
Last active Dec 13, 2015
python 2.7 csv reader the supports unicode (hebrew)
View unicode csv reader
#based on a stackoverflow answer, I currently can't find.
import csv
def unicode_csv_reader(utf8_data, dialect=csv.excel, **kwargs):
helper function: a generic csv reader function adapted to unicode
unicode_reader = csv.reader(utf8_data, dialect=dialect, encoding = 'windows-1255', **kwargs)# opening the file with python csv reader
alonisser / double.js
Created May 21, 2013
a whatwg suggestion to solve to double sumbitting forms problem
View double.js
//a crude polyfill to handle this functionality
alonisser /
Last active Dec 17, 2015
memo to self: how to setup a python developer windows 7 computer

#Setting up a windows 7 python dev computer

  • Set up a dev folder in root with subfolders: projects, programs, custom, envs.

  • Set a HOME (Check specific) variable to point to c:\dev\custom so .dot files should go there.

  • Python: install python 2.7.X 32bit in dev\programs also easy_install pip,and pip install virtualenv.

  • Install virtualenv-wrapper for windows and sets WORKON_HOME to c:\dev\envs

alonisser /
Created Jul 15, 2013
A naive implentation of a pre commit jslinting hook
# A naive implentation of a pre commit jslinting hook
# First: checking if jshint is installed
retval=`jshint ; echo $?`
if [[ retval -ne 0 ]]
echo "You have to install JSHINT for this to work"
echo "npm install -g jshint"
exit 1
#Inspired by
#Since every `git pull` is actually a merge. We can use it to automaticly run basic Django tasks after pulling from the upstream master branch (or any other)
#Notice: This won't run at git fetch. since fetch doesn't merge anything
# copy this script with the name:`` to your project root folder
# symlink it to the ./git/hooks/post-merge: `ln .git/hooks/post-merge
#You should have bash (windows users, means cygwin/mingw anything that works for you
#Based on the instructions here: