Skip to content

Instantly share code, notes, and snippets.

@nerdolo
nerdolo / quadrangle to triangles
Created Apr 20, 2020
function for dividing quadrangle into two triangles that create it regardless of initial points order
View quadrangle to triangles
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
@robertpitt
robertpitt / socks5.js
Created Jul 30, 2012
SOCKS5 Server as per rfc1928 (nodejs)
View socks5.js
/**
* SOCKS5 Proxy as per RFC1928
* @see : http://www.ietf.org/rfc/rfc1928.txt
*/
/**
* Load Dependancies
*/
var net = require('net'),
@fcicq
fcicq / ed2kHash.py
Last active Aug 18, 2018
ed2kHash class for python (you may use it as alcc)
View ed2kHash.py
# by fcicq (fcicq at fcicq dot net) @ 2012.5.12, Released under GPLv2
import hashlib
try:
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