Skip to content

Instantly share code, notes, and snippets.

View Decision2016's full-sized avatar

Decision Decision2016

View GitHub Profile
import socket
import struct
import json
def unpack_varint(s):
d = 0
for i in range(5):
b = ord(s.recv(1))
d |= (b & 0x7F) << 7*i
if not b & 0x80:
@mandiwise
mandiwise / Count lines in Git repo
Last active July 4, 2024 16:56
A command to calculate lines of code in all tracked files in a Git repo
// Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository
$ git ls-files | xargs wc -l
@mrexodia
mrexodia / IntelPIN.cmake
Last active May 9, 2023 15:15
IntelPIN.cmake
# Website: https://software.intel.com/content/www/us/en/develop/articles/pin-a-binary-instrumentation-tool-downloads.html
# License: https://software.intel.com/sites/landingpage/pintool/pinlicense.txt
# This snippet: https://gist.github.com/mrexodia/f61fead0108603d04b2ca0ab045e0952
# TODO: lunix support
# Thanks to Francesco for showing me this method
CPMAddPackage(
NAME IntelPIN
VERSION 3.18
URL https://software.intel.com/sites/landingpage/pintool/downloads/pin-3.18-98332-gaebd7b1e6-msvc-windows.zip
@ZipFile
ZipFile / README.md
Last active July 12, 2024 08:15
Pixiv OAuth Flow

Retrieving Auth Token

  1. Run the command:

    python pixiv_auth.py login

    This will open the browser with Pixiv login page.

@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__)