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 | |
# Quick and dirty demonstration of CVE-2014-0160 by | |
# Jared Stafford (jspenguin@jspenguin.org) | |
# Modified so that it finds cookies | |
import sys | |
import struct | |
import socket | |
import time | |
import select |
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
tim@tim ~> gem install jekyll | |
Fetching: liquid-2.5.5.gem (100%) | |
Successfully installed liquid-2.5.5 | |
Fetching: fast-stemmer-1.0.2.gem (100%) | |
Building native extensions. This could take a while... | |
Successfully installed fast-stemmer-1.0.2 | |
Fetching: classifier-1.3.4.gem (100%) | |
Successfully installed classifier-1.3.4 | |
Fetching: ffi-1.9.3.gem (100%) | |
Building native extensions. This could take a while... |
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
# saved from http://github.com/jhsu/ubstatus/blob/master/main.rb for reference | |
require 'sinatra' | |
require 'sinatra/activerecord' | |
require 'net/http' | |
require 'haml' | |
require 'lib/models/site.rb' | |
require 'lib/models/user.rb' | |
configure do |
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 'rubygems' | |
require 'sinatra' | |
enable :sessions | |
get '/' do | |
session["value"] ||= "Hello world!" | |
"The cookie you've created contains the value: #{session["value"]}" | |
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
# Depends on the OS X "say" command | |
import time, datetime, subprocess, math, sys | |
def say(s): | |
subprocess.call(['say', str(s)]) | |
def seconds_until(dt): | |
return time.mktime(dt.timetuple()) - time.time() |
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 (!navigator.geolocation) { | |
navigator.geolocation = (function (window) { | |
function getCurrentPosition(callback) { | |
// NOTE: for some reason, chaging the url is *allowed* with this service. Useful, but random | |
// source: http://www.maxmind.com/app/javascript_city | |
// The source is open source, as per: http://www.maxmind.com/app/api, but doesn't discuss specific license use. Hopefully it's just free to use - yay internet! | |
var geourl = 'http://j.maxmind.com/app/geoip.js_' + Math.random(), | |
iframe = document.createElement('iframe'), | |
doc, win; |
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
<?php | |
/** | |
* A little Object Relational Mapper in PHP | |
* @author dennis.hotson@gmail.com | |
*/ | |
class Post | |
{ | |
public $title; |
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
# Install virtualenv | |
sudo pip install virtualenv | |
# Create the virtual environment | |
virtualenv sandbox | |
# Play around with Python inside the new 'sandbox' | |
cd sandbox | |
./bin/python | |
cd .. |
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
#pseudo code | |
#option 1 | |
class User: | |
screen_name = '' | |
email = '' | |
class UserManager: | |
def validate(user): | |
if user.screen_name == '': |
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
<?php | |
$english = arr( | |
strr('Hello X'), | |
strr('Goodbye X') | |
); | |
$pirate = $english | |
->replace('/Hello/', 'Avast') | |
->replace('/Goodbye/', 'Was good te see ye') |
OlderNewer