This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[1] pry(main)> class Foo | |
[1] pry(main)* def hello | |
[1] pry(main)* "Hello from Foo" | |
[1] pry(main)* end | |
[1] pry(main)* end | |
=> nil | |
[2] pry(main)> module Mod | |
[2] pry(main)* def hello | |
[2] pry(main)* "Hello from Mod" | |
[2] pry(main)* end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [5]: [ (n, 0.5 ** n) for n in range(1, 15) ] | |
Out[5]: | |
[(1, 0.5), | |
(2, 0.25), | |
(3, 0.125), | |
(4, 0.0625), | |
(5, 0.03125), | |
(6, 0.015625), | |
(7, 0.0078125), | |
(8, 0.00390625), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# Written for PyUSB 1.0 (w/libusb 1.0.3) | |
# | |
# Original Author: [email protected] | |
# Heavily edited by bensonk42 -at- gmail | |
# | |
# Version: 2013-02-26 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, abort, redirect, url_for | |
app = Flask(__name__) | |
class Datastore(object): | |
def __init__(self, **kwargs): | |
for k,v in kwargs.items(): | |
self.__setattr__(k, v) | |
ds = Datastore(who='World') | |
@app.route('/') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python -u | |
from os import system | |
from sys import stdin | |
while True: | |
line = stdin.readline() | |
if '200 OK' in line: | |
system("notify-send -t 3000 -a Notifier '{}'".format(line)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
get "/" do | |
mpc_output = IO.popen("mpc").readlines.join("<br/>") | |
"<html><body>" + | |
" <h3>#{mpc_output}</h3>" + | |
' <p><a href="prev">prev</a> <a href="/toggle">play/pause</a> <a href="/next">next</a></p>' + | |
"</body></html>" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import re | |
parser = re.compile(r'(.*?);(.*?);(.{3});(.*?);(.*?);') | |
def parse_line(l): | |
res = parser.match(l) | |
if res: | |
values = res.groups() | |
credential = {} | |
credential['username'] = values[0] | |
credential['hash'] = values[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[work] bensonk@thay ~ $ nc www.reddit.com 80 | |
GET / HTTP/1.1 | |
Host: www.reddit.com | |
Connection: keep-alive | |
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.162 Safari/535.19 | |
Accept: text/html | |
Accept-Language: en-US,en;q=0.8 | |
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 | |
Cookie: djdt=hide; sessionid=5b192a9ec238e8a4a16e87729b84fc52; __utma=1.800606738.1333945678.1334169935.1334174604.12; __utmz=1.1333945678.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Meteor.is_client) { | |
var people = new Meteor.Collection("people"); | |
people.insert({name: "Benson"}); | |
Template.people.names = function() { | |
return people.find(); | |
}; | |
} | |
if (Meteor.is_server) { |
NewerOlder