Skip to content

Instantly share code, notes, and snippets.

View alonisser's full-sized avatar

Alonisser alonisser

View GitHub Profile
@alonisser
alonisser / unicode csv reader
Last active December 13, 2015 20:28
python 2.7 csv reader the supports unicode (hebrew)
#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
alonisser / double.js
Created May 21, 2013 09:42
a whatwg suggestion to solve to double sumbitting forms problem
//a crude polyfill to handle this functionality
@alonisser
alonisser / setup.md
Last active December 17, 2015 20:38
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
alonisser / precommit.sh
Created July 15, 2013 09:34
A naive implentation of a pre commit jslinting hook
#!/bin/sh
# A naive implentation of a pre commit jslinting hook
# First: checking if jshint is installed
retval=`jshint ; echo $?`
if [[ retval -ne 0 ]]
then
echo "You have to install JSHINT for this to work"
echo "npm install -g jshint"
exit 1
fi
@alonisser
alonisser / common_vagrant_problems.md
Last active March 24, 2017 15:53
Fixing vagrant virtualbox problems
  1. Uncomment vb.gui=true in the vagrantfile and log in from there. solves a lot of problems, can also sudo reboot from there.
  2. To unlock 'guru meditation' mode: navigate to the virtualbox folder and: VBoxManage controlvm <vm> poweroff (notice this the virtualbox full vm name and not the vagrant name)
  3. Upgrade to virtualbox 4.16 ,solves 4.14 problems with vagrant 1.2.2
  4. Add more memory to the virtualbox (not more than the host machine has)
  5. check the bios setting allowing virtualization is enabled
#!/bin/sh
#Inspired by https://gist.github.com/jbergantine/3870080
#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
#Installation:
# copy this script with the name:`post-merge.sh` to your project root folder
# symlink it to the ./git/hooks/post-merge: `ln post-merge.sh .git/hooks/post-merge
#You should have bash (windows users, means cygwin/mingw anything that works for you
#Based on the instructions here: https://oknesset-devel.readthedocs.org/en/latest/workflow.html#before-coding
@alonisser
alonisser / post-merge.sh
Created December 29, 2013 08:43
git hook for bower install and npm install on bower.json/package.json change
#!/bin/sh
#Inspired by https://gist.github.com/jbergantine/3870080
#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
#Installation:
# copy this script with the name:`post-merge.sh` to your project root folder
# symlink it to the ./git/hooks/post-merge: `ln post-merge.sh .git/hooks/post-merge
#You should have bash (windows users, means cygwin/mingw anything that works for you
#Based on the instructions here: https://oknesset-devel.readthedocs.org/en/latest/workflow.html#before-coding
@alonisser
alonisser / generate_plugins.sh
Created April 18, 2014 20:08
Generate a list of current vim plugins including path and git repo
set -e
trim() {
#http://stackoverflow.com/questions/369758/how-to-trim-whitespace-from-bash-variable
local var=$@
var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters
echo -n "$var"
}
#!/bin/bash
#
# Bash script to setup headless Selenium (uses Xvfb and Chrome)
# (Tested on Ubuntu 12.04) trying on ubuntu server 14.04
# Add Google Chrome's repo to sources.list
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list
# Install Google's public key used for signing packages (e.g. Chrome)
# (Source: http://www.google.com/linuxrepositories/)
@alonisser
alonisser / sources_list.md
Created June 28, 2014 20:27
ppa and sources tweaking for setting up a new ubuntu machine

ppa to add

sudo add-apt-repository ppa:pdoes/ppa #git
sudo add-apt-repository ppa:nginx/stable #nginx
sudo add-apt-repository ppa:chris-lea/node.js #node.js
sudo add-apt-repository ppa:fish-shell/release-2 #fish

In sources.list