Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
@teeceepee
teeceepee / bilibili-youku.js
Last active January 3, 2016 20:59
bilibili优酷黑科技
// 只访问播放器页面
javascript:location.href='https://secure.bilibili.tv/secure,cid='+document.getElementById('bofqi').childNodes[2].attributes.flashvars.value.split(/[=&]/)[1];
// 替换优酷播放器,保留页面其他内容。将所有内容用void()包裹来防止页面刷新, 参考 http://www.ruanyifeng.com/blog/2011/06/a_guide_for_writing_bookmarklet.html
javascript:void(document.getElementById('bofqi').innerHTML='<iframe width="950" scrolling="no" height="482" frameborder="no" onload="window.securePlayerFrameLoaded=true" framespacing="0" border="0" src="####" class="player"></iframe>'.replace("####",'https://secure.bilibili.tv/secure,cid='+document.getElementById('bofqi').childNodes[2].attributes.flashvars.value.split(/[=&]/)[1]));
var cid = document.getElementById('bofqi').childNodes[2].attributes.flashvars.value.split(/[=&]/)[1];
var url = 'https://secure.bilibili.tv/secure,cid=' + cid;
@jboner
jboner / latency.txt
Last active June 27, 2024 14:47
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@lporras
lporras / gist:2403098
Created April 17, 2012 03:00
Using Backbone Views With Rails jQuery-ujs
var FormView = Backbone.View.extend({
el: '#form',
events: {
// Fired automatically when a file-type input is detected with a
// non-blank value. You can use this hook to implement a handler that
// will deal with those non-blank file inputs. Returning false will
// disallow standard form submission.
'ajax:aborted:file' : 'ajaxAbortedFile',
@pfleidi
pfleidi / fiberchat.rb
Created February 19, 2011 18:51
A naive socket chat using select() and ruby fibers
require 'rubygems'
require 'socket'
include Socket::Constants
class ChatServer
def initialize
@reading = Array.new
@writing = Array.new
@clients = Hash.new