Skip to content

Instantly share code, notes, and snippets.

🤖
Beep-boop

Zach Aysan zachaysan

🤖
Beep-boop
Block or report user

Report or block zachaysan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:8029e71fd212a31d7f58
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)
View gist:28cd7971bd5a1dfc0c50
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}"
View 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

View gist:8528535
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]
View gist:7603526
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:
View gist:7100458
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 Nov 17, 2012
Code to alter the original
View eric.py
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 Jul 13, 2012
Clean out distracting files
View cleaner.py
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 Jun 6, 2012
My version of the sq thing
View squarer.py
class Point(object):
def __init__(self):
self.x = None
self.y = None
a = Point()
b = Point()
a.x = 20
a.y = 1
You can’t perform that action at this time.