Skip to content

Instantly share code, notes, and snippets.

robertpitt / socks5.js
Created July 30, 2012 01:30
SOCKS5 Server as per rfc1928 (nodejs)
* SOCKS5 Proxy as per RFC1928
* @see :
* Load Dependancies
var net = require('net'),
fcicq /
Last active August 18, 2018 11:54
ed2kHash class for python (you may use it as alcc)
# by fcicq (fcicq at fcicq dot net) @ 2012.5.12, Released under GPLv2
import hashlib
from cStringIO import StringIO
except ImportError:
from io import BytesIO as StringIO
if bytes != str: ord = int
class ed2kHash():
CHUNK_SIZE = 9728000
BLOCK_SIZE = 262144
nerdolo / quadrangle to triangles
Created April 20, 2020 19:46
function for dividing quadrangle into two triangles that create it regardless of initial points order
import math
def matrix_det(mat): # mat - matrix
det, k_1, k_2 = 0, 1, 1
for i in range(3):
for j in range(3):
k_1 *= mat[(i + j) % 3][j % 3]
k_2 *= mat[-((i + j) % 3)][-(j % 3)]
det += k_1 - k_2
return det
coderjo /
Last active April 7, 2024 02:48
access a disk image read-only with a copy-on-write overlay to allow fsck or the like to write changes
# usage: [imagefile] [cowfile] [devname]
# imagefile: path to the image file you want to load
# cowfile: path to the file to store writes into. If it doesn't exist, a sparse 1GB file will be created.
# devname: the name you want the drive to show up as in /dev/mapper
jonte /
Last active May 16, 2024 23:03
Emulating a tmp105 temperature sensor using QEMU and Linux

This will configure QEMU to expose a tmp105 temperature sensor on the i2c-0 bus on x86_64. The temterature sensor can have its temperature set from the host OS, and the temperature can be read from the Linux client OS using the lm75 kernel module.

Building QEMU

For convenience, we will be emulating an x86 system. The x86 configuations which QEMU ships with do not contain the tmp105 sensor we will be using, so first we need to enable it.

Assuming you have the qemu sources in the qemu directory:

# cd qemu

echo "CONFIG_TMP105=y" >> default-configs/i386-softmmu.mak