Skip to content

Instantly share code, notes, and snippets.

View trishmapow's full-sized avatar
🐍
__import__('ctypes').string_at(0)

Christopher Malau trishmapow

🐍
__import__('ctypes').string_at(0)
View GitHub Profile
@gmolveau
gmolveau / flask_separate_thread.py
Last active March 6, 2023 07:27
run a flask application in a separate thread
# please use python3 and flask > 1.0
# run this with : python3 flask_separate_thread.py
# https://web.archive.org/web/20210329135424/https://pymotw.com/3/threading/
# https://web.archive.org/web/20210329135553/https://eli.thegreenplace.net/2011/08/22/how-not-to-set-a-timeout-on-a-computation-in-python
import time
import threading
from flask import Flask
app = Flask(__name__)
#!/usr/bin/env python3
import z3
import pprint
# 9x9 matrix of integer variables
X = [ [ z3.Int("x_%s_%s" % (i+1, j+1)) for j in range(9) ]
for i in range(9) ]
# each cell contains a value in {1, ..., 9}
cells_c = [ z3.And(1 <= X[i][j], X[i][j] <= 9)
@shakna-israel
shakna-israel / Prose.md
Last active November 15, 2023 22:06
Obfuscating Python

Obfuscating Python

Obfuscation isn't difficult in most programming languages. It's why we have "good practices" because it is so easy to hide what you mean in badly written code.

Obfuscation tends to be even easier in dynamic languages because of how forgiving they tend to be - and because they tend to give you direct access to the environment so that you can manipulate it.

Today, for fun, I'm going to obfuscate this code:

def _(n):

if n <= 0:

@MIvanchev
MIvanchev / article.md
Last active April 4, 2023 13:39
Ever wondered what it takes to run Windows software on ARM? Then this article might be for you!
@trishmapow
trishmapow / Q_rsqrt.c
Last active May 14, 2017 11:00
Fast Inverse Square Root (Quake III Arena)
float Q_rsqrt( float number )
{
long i;
float x2, y;
const float threehalfs = 1.5F;
x2 = number * 0.5F;
y = number;
i = * ( long * ) &y; // Store physical representation of bits
i = 0x5f3759df - ( i >> 1 ); // Make an initial guess
@tegila
tegila / mt7601.sh
Created April 15, 2015 15:23
MediaTek MT7601 to Raspberry Pi 2 Raspbian
## Fetch source code from firmware and linux
git clone --depth 1 https://github.com/raspberrypi/firmware
git clone --depth=1 -b rpi-3.19.y --single-branch https://github.com/raspberrypi/linux
## Update firmware files
sudo mkdir /boot/backup
sudo cp /boot/* /boot/backup/
sudo cp -r firmware/modules /lib
sudo cp -r src/firmware/boot /
sudo cp firmware/extra/Module7.symvers linux/Module.symvers
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 7, 2024 06:03
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname