This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# SPDX-License-Identifier: GPL-2.0 | |
import argparse | |
import sys | |
parser = argparse.ArgumentParser() | |
parser.add_argument('inputFiles', nargs='+', type=argparse.FileType('rb')) | |
parser.set_defaults(PSZ=4, help='pointer size') | |
parser.add_argument('--32', dest='PSZ', action='store_const', | |
const=4, help="32-bit pointers") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Build instructions: `gcc main.c -O2 -lm && time ./a.out` | |
//This takes roughly 1-4 minutes to run, depending on single-core CPU speed | |
#include <math.h> | |
#include <stddef.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <time.h> | |
/* The state must be initialized to non-zero */ | |
static inline uint32_t xorshift32(uint32_t x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Scan a serial port at different baud rates looking for a human-readable terminal | |
#By: RSAXVC | |
import serial | |
#List of possible baud rates to scan | |
bauds = [ 110, 150, 300, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600] | |
#Path to POSIX port or Windows COM# | |
port = '/dev/ttyUSB0' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unordered_set> | |
#include <cstdio> | |
//Represents bits from a register | |
#define reg_t unsigned | |
//Keep track of register contents seen already | |
std::unordered_set<reg_t> ks; | |
//Read either K0 or K1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pyAudio demo by RSAXVC | |
#Generates a transmit waveform of a near frequency, | |
#and plays it in a loop, while listening to the mic | |
#and plotting it | |
import pyaudio | |
import numpy as np | |
import struct | |
import matplotlib.pyplot as plt | |
import matplotlib.animation as animation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#COBS encoder using minimal buffer instead of encoding entire buffer at once | |
#Passes unit tests from Wikipedia page | |
class cobsEncoder: | |
def __init__(self): | |
self.cobsBuffer = b'' | |
self.postZero = False | |
def encode(self,data): | |
for d in data: | |
if d == b'\x00': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#This script assumes #BOINC <= #Cores. To fix this, use a modulo function. | |
CORE=0 | |
pgrep -f "/usr/lib/virtualbox/VBoxHeadless --comment boinc_" | while read -r pid ; do | |
taskset -a -pc "$CORE" "$pid" #This locks the VM to a specific core. | |
CORE=$((CORE+1)) #Use this without hyperthreading | |
#CORE=$((CORE+2)) #Use this with hyperthreading | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file describes how to configure a Linux computer as a router for GoogleFiber. | |
# References: | |
# https://wiki.debian.org/NetworkConfiguration#Bridges_and_VLANs | |
# https://wiki.debian.org/BridgeNetworkConnections#Configuring_bridging_in_.2Fetc.2Fnetwork.2Finterfaces | |
# http://flyovercountry.org/2014/02/google-fiber-gigabit-speeds-your-router-part-2-qos/ | |
source /etc/network/interfaces.d/* | |
# The loopback network interface | |
auto lo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
/* | |
* example.c | |
* | |
* This file illustrates how to use the IJG code as a subroutine library | |
* to read or write JPEG image files. You should look at this code in | |
* conjunction with the documentation file libjpeg.txt. | |
* | |
* This code will not do anything useful as-is, but it may be helpful as a | |
* skeleton for constructing routines that call the JPEG library. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# | |
# Eric Jiang | |
# http://notes.ericjiang.com/posts/54 | |
# This software is public domain. | |
# | |
use bytes; | |
my $data; |