For excessively paranoid client authentication.
Updated Apr 5 2019:
because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.
some other notes:
| # Author: Pieter Noordhuis | |
| # Description: Simple demo to showcase Redis PubSub with EventMachine | |
| # | |
| # Requirements: | |
| # - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby | |
| # - a browser with WebSocket support | |
| # | |
| # Usage: | |
| # ruby redis_pubsub_demo.rb | |
| # |
| import fcntl | |
| import os | |
| import struct | |
| import subprocess | |
| # Some constants used to ioctl the device file. I got them by a simple C | |
| # program. | |
| TUNSETIFF = 0x400454ca | |
| TUNSETOWNER = TUNSETIFF + 2 |
| // Copyright 2011 Will Fitzgerald. All rights reserved. | |
| // Use of this source code is governed by a BSD-style | |
| // license that can be found in the LICENSE file. | |
| /* | |
| Package bitset implements bitsets. | |
| It provides methods for making a bitset of an arbitrary | |
| upper limit, setting and testing bit locations, and clearing | |
| bit locations as well as the entire set. |
| require "fiber" | |
| require "rack/fiber_pool" | |
| require "sinatra/base" | |
| require "redis" | |
| require "redis/connection/synchrony" | |
| class App < Sinatra::Base | |
| use Rack::FiberPool |
| require "bson" | |
| def make_insert(table_name, bson) | |
| columns = ["id",*bson["value"].keys] * ", " | |
| values = ["'#{bson["_id"]}'",*bson["value"].values.map{|value| value.is_a?(Numeric) ? value : "'#{value}'"}] * ", " | |
| return "insert into #{table_name} (#{columns}) values (#{values});" | |
| end | |
| file_name = ARGV.first | |
| file=File.new(file_name) |
| package main | |
| import ( | |
| "bytes" | |
| "encoding/hex" | |
| "flag" | |
| "fmt" | |
| "io" | |
| "log" | |
| "net" |
| #!/usr/bin/env ruby | |
| require 'iconv' | |
| require 'nokogiri' | |
| # This is a simple script to spider your Netflix paginated "What You've Rated" list. | |
| # It requires an OS X based system with Ruby 1.9+, Safari, and AppleScript | |
| # | |
| # I could not find a way to back up my ratings (for all titles, not just my rental activity) | |
| # without registering for a Netflix API key or handing my Netflix credentials over to someone | |
| # who had an API key, so I decided to take a brute force approach and just parse the HTML for |
| ''' | |
| Python implementation of Haskell's | |
| sieve xs = sieve' xs Map.empty | |
| where | |
| sieve' [] table = [] | |
| sieve' (x:xs) table = | |
| case Map.lookup x table of | |
| Nothing -> x : sieve' xs (Map.insert (x*x) [x] table) | |
| Just facts -> sieve' xs (foldl reinsert (Map.delete x table) facts) |
| """ | |
| Licensed under the Apache License, Version 2.0: | |
| http://www.apache.org/licenses/LICENSE-2.0 | |
| """ | |
| from google.appengine.ext import webapp | |
| from google.appengine.ext.webapp.util import run_wsgi_app | |
| redirects = { | |
| '/learning': 'http://blog.pamelafox.org', |