Skip to content

Instantly share code, notes, and snippets.

#!/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
@pims
pims / lol-ruby
Created May 8, 2014 04:25
Installing Jekyll
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...
# 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
require 'rubygems'
require 'sinatra'
enable :sessions
get '/' do
session["value"] ||= "Hello world!"
"The cookie you've created contains the value: #{session["value"]}"
end
# 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()
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;
@pims
pims / gist:295757
Created February 5, 2010 12:46 — forked from dhotson/gist:295737
<?php
/**
* A little Object Relational Mapper in PHP
* @author dennis.hotson@gmail.com
*/
class Post
{
public $title;
@pims
pims / virtualenv.txt
Created February 24, 2010 17:01 — forked from hugs/virtualenv.txt
# 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 ..
#pseudo code
#option 1
class User:
screen_name = ''
email = ''
class UserManager:
def validate(user):
if user.screen_name == '':
<?php
$english = arr(
strr('Hello X'),
strr('Goodbye X')
);
$pirate = $english
->replace('/Hello/', 'Avast')
->replace('/Goodbye/', 'Was good te see ye')