Skip to content

Instantly share code, notes, and snippets.

@sampsyo
sampsyo / aliases.py
Created July 11, 2010 20:04
hack for argparse adding subcommand aliases
#!/usr/bin/env python
"""Aliases for argparse positional arguments."""
import argparse
class AliasedSubParsersAction(argparse._SubParsersAction):
class _AliasedPseudoAction(argparse.Action):
def __init__(self, name, aliases, help):
@Circuitsoft
Circuitsoft / Output
Created August 4, 2011 22:02
Capture single image V4L2
Driver Caps:
Driver: "omap3"
Card: "omap3/mt9v032//"
Bus: ""
Version: 0.0
Capabilities: 04000001
Camera Cropping:
Bounds: 752x480+0+0
Default: 752x480+0+0
Aspect: 1/1
@maxlapshin
maxlapshin / capture_raw_frames.c
Created September 30, 2011 11:50
v4l2 capture example
/*
* V4L2 video capture example
*
* This program can be used and distributed without restrictions.
*
* This program is provided with the V4L2 API
* see http://linuxtv.org/docs.php for more information
*/
#include <stdio.h>
@bellbind
bellbind / ecc.py
Created December 1, 2011 08:08
[python]basics of elliptic curve cryptography
# Basics of Elliptic Curve Cryptography implementation on Python
import collections
def inv(n, q):
"""div on PN modulo a/b mod q as a * inv(b, q) mod q
>>> assert n * inv(n, q) % q == 1
"""
for i in range(q):
if (n * i) % q == 1:
@augustoproiete
augustoproiete / GrantAccess-WindowsApps.cmd
Created October 12, 2012 17:52
Get access to the %ProgramFiles%\WindowsApps folder and view apps source code
@REM More info:
@REM http://caioproiete.net/en/get-access-to-the-programfileswindowsapps-folder-and-view-apps-source-code/
@echo Backing up current folder permissions to a temporary file
@icacls "%ProgramFiles%\WindowsApps" /save "%TEMP%\WindowsApps.acl" /Q
@if ERRORLEVEL 1 goto rollback
@echo Assigning the ownership of the folder to the current logged user
@takeown /F "%ProgramFiles%\WindowsApps"
@if ERRORLEVEL 1 goto rollback
@kevinmehall
kevinmehall / instructions.md
Created October 20, 2012 23:42
Compiling the Atmel-patched AVR toolchain
@niranjan-nagaraju
niranjan-nagaraju / tcpdump_tcpreplay.org
Last active October 26, 2023 10:15
TCPReplay/TCPRewrite/TCPPrep/TCPDump Cheatsheet

TCPReplay/TCPRewrite/TCPPrep/TCPDump Cheatsheet

tcprewrite

Rewrite IP/Mac addresses, -C optionally to fix checksums

  1. tcpprep, first:C2S, Second S2C, Generate cache file
        
@fqrouter
fqrouter / overlapped_ip_fragmentation.py
Created January 16, 2013 15:50
the code to send ip fragment was copied from scapy, verified by tcpdump it indeed send two packet instead of one. However, GFW still can decode the content despite we are using overlapped ip fragmentation. But, 8.8.8.8 dropped the fragmented ip packet, for security reason.
from netfilterqueue import NetfilterQueue
import traceback
import subprocess
import signal
import dpkt
import socket
raw_socket = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(3))
raw_socket.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 2**30)

Exploiting Lua 5.1 on 32-bit Windows

The following Lua program generates a Lua bytecode program called ignore-unsigned-sga.fnt, which in turn loads a DLL from within an extremely locked down Lua 5.1 sandbox in a program called RelicCOH2.exe. The remainder of this document attempts to explain how this program works by a whirlwind tour of relevent bits of the Lua 5.1 virtual machine.

if string.dump(function()end):sub(1, 12) ~= "\27Lua\81\0\1\4\4\4\8\0" then
  error("This generator requires a 32-bit version of Lua 5.1")
end

local function outer()
  local magic -- In bytecode, the stack slot corresponding to this local is changed
@h4cc
h4cc / howto.md
Last active November 28, 2022 12:53
Getting Thumbnails / Previews of your RAW files in Ubuntu

Howto

Install these programms

sudo apt-get install gnome-raw-thumbnailer ufraw-batch

Try now if everything works, and your thumbnails show up. If not, try the following part.