Skip to content

Instantly share code, notes, and snippets.

View zachaysan's full-sized avatar
🏎️
🚗

Zach Aysan zachaysan

🏎️
🚗
View GitHub Profile
import pdb
import atexit
import os
import readline
from pathlib import Path
class Config(pdb.DefaultConfig):
sticky_by_default = True
@zachaysan
zachaysan / FUCKING AWESOME OVER HERE
Created February 20, 2015 20:55
BEST GIST EVER
a = []
a[0] = a
@zachaysan
zachaysan / node-and-npm-in-30-seconds.sh
Created May 5, 2011 16:18 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
printf '\nexport PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl http://npmjs.org/install.sh | sh
setting = Hash.new("Some default string")
setting[0] = "some string"
setting[1] = "some other string"
postLoginAction = 0
puts setting[postLoginAction]
postLoginAction = 1
puts setting[postLoginAction]
postLoginAction = 5
puts setting[postLoginAction]
Buffers Tools Python Help
import random
def flip(n):
on_tails = -1000 * 1000
if n == 0:
return 1
elif random.random() < 0.5:
return on_tails
else:
@zachaysan
zachaysan / gist:7100458
Created October 22, 2013 13:08
insertAtCaret
jQuery.fn.extend insertAtCaret: (myValue) ->
@each (i) ->
if document.selection
@focus()
sel = document.selection.createRange()
sel.text = myValue
@focus()
else if @selectionStart or @selectionStart is "0"
startPos = @selectionStart
endPos = @selectionEnd
@zachaysan
zachaysan / eric.py
Created November 17, 2012 17:35
Code to alter the original
def artistic_black_and_white(image, order=2):
pix = pixel_array(image)
draw = ImageDraw.Draw(image)
for y in range(image_height(image)):
for x in range(image_width(image)):
r,g,b = pix[x,y]
grey_value = (r + g + b)/3
adjusted_value = int(((grey_value / 255.0) ** (1 / float(order)) * grey_value))
r = adjusted_value
@zachaysan
zachaysan / cleaner.py
Created July 13, 2012 14:44
Clean out distracting files
import os
def clean():
for root, dirs, files in os.walk(os.getcwd()):
for f in files:
p = os.path.join(root, f)
if p[-1] == "~" or p[-4:] == ".pyc":
os.remove(p)
if __name__ == '__main__':
@zachaysan
zachaysan / squarer.py
Created June 6, 2012 19:40
My version of the sq thing
class Point(object):
def __init__(self):
self.x = None
self.y = None
a = Point()
b = Point()
a.x = 20
a.y = 1
155.254.225.2 Afghanistan, Kabul
194.112.11.130 Aland Islands, Mariehamn
104.167.254.2 Albania, Tirana
45.59.177.2 Algeria, Annaba
104.224.33.2 Anguilla, The Valley
104.224.1.2 Antigua and Barbuda, Saint John's
200.55.243.196 Argentina, Buenos Aires
45.59.129.3 Armenia, Tsaghkadzor
104.224.32.2 Aruba, Palm Beach
203.31.216.1 Australia, New South Wales, Sydney (LOC1 S1)