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
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)
cities = ["Texas", "Amsterdam", "New York", "Toronto", "Phoenix", "Los Angeles"]
cities += ["San Francisco", "Miami", "Chicago", "Dallas", "Houston"]
while true
begin
system("./hma-vpn.sh #{cities.sample}) &")
sleep rand * 12
system('killall "hma-vpn.sh"')
rescue StandardError => e
puts "Error #{e}"
@zachaysan
zachaysan / FUCKING AWESOME OVER HERE
Created February 20, 2015 20:55
BEST GIST EVER
a = []
a[0] = a
@zachaysan
zachaysan / notes.md
Last active August 29, 2015 14:15 — forked from monicao/notes.md

Rethinking CoffeeScript

CoffeeScript was written by Jeremy Ashkenas, a Ruby developer who was fed up with the quirks of JavaScript. It was an instant success in the Ruby community. Many people were tired of having to type === instead of ==, of JavaScript's crappy lexical scoping, of having to jump through hoops to set up even the most simple inheritance structure, of variables leaking into the global scope or having to worry about silly things like hoisting.

This was a time when web user interfaces were becoming more complex and backend developers had to spend more and more time writing JavaScript code. For a long time, coding in JavaScript meant you spent 100% of your time using jQuery. And what an epic mess that was!

At that time many people did not consider JavaScript to be a real programming language, because of it's oddities. So when CoffeeScript came along developers (especially Ruby developers) embraced it as a way to make coding in JavaScript suck less. I was one of those developers. I liked

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__':