Skip to content

Instantly share code, notes, and snippets.

💭
U+1F4A9

Ben Iofel benwaffle

💭
U+1F4A9
Block or report user

Report or block benwaffle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@benwaffle
benwaffle / stm32-crc32.js
Last active Jun 8, 2019
stm32's crc32-mpeg2 implementation for js
View stm32-crc32.js
const { Buffer } = require('buffer');
// stolen from https://gist.github.com/Miliox/b86b60b9755faf3bd7cf
let TABLE = [
0x00000000,0x04C11DB7,0x09823B6E,0x0D4326D9,0x130476DC,0x17C56B6B,0x1A864DB2,0x1E475005,0x2608EDB8,0x22C9F00F,0x2F8AD6D6,0x2B4BCB61,0x350C9B64,0x31CD86D3,0x3C8EA00A,0x384FBDBD,0x4C11DB70,0x48D0C6C7,0x4593E01E,0x4152FDA9,0x5F15ADAC,0x5BD4B01B,0x569796C2,0x52568B75,0x6A1936C8,0x6ED82B7F,0x639B0DA6,0x675A1011,0x791D4014,0x7DDC5DA3,0x709F7B7A,0x745E66CD,0x9823B6E0,0x9CE2AB57,0x91A18D8E,0x95609039,0x8B27C03C,0x8FE6DD8B,0x82A5FB52,0x8664E6E5,0xBE2B5B58,0xBAEA46EF,0xB7A96036,0xB3687D81,0xAD2F2D84,0xA9EE3033,0xA4AD16EA,0xA06C0B5D,0xD4326D90,0xD0F37027,0xDDB056FE,0xD9714B49,0xC7361B4C,0xC3F706FB,0xCEB42022,0xCA753D95,0xF23A8028,0xF6FB9D9F,0xFBB8BB46,0xFF79A6F1,0xE13EF6F4,0xE5FFEB43,0xE8BCCD9A,0xEC7DD02D,0x34867077,0x30476DC0,0x3D044B19,0x39C556AE,0x278206AB,0x23431B1C,0x2E003DC5,0x2AC12072,0x128E9DCF,0x164F8078,0x1B0CA6A1,0x1FCDBB16,0x018AEB13,0x054BF6A4,0x0808D07D,0x0CC9CDCA,0x7897AB07,0x7C56B6B
@benwaffle
benwaffle / orangepi-pinout.py
Created Apr 21, 2019
OrangePI rk3399 pin calculator
View orangepi-pinout.py
#!/usr/bin/env python
from sys import argv, exit
if len(argv) != 2:
print('Usage: ./orangepi-pinout.py <GPIO1_B3>')
exit()
gpio = argv[1]
assert(gpio[:4] == 'GPIO')
View voting-members.js
const fs = require('fs')
const assert = require('assert')
const process = require('process')
const files = fs.readdirSync('.').filter(x => x.endsWith('.csv'))
const text = files.map(f => fs.readFileSync(f).toString())
const events = [].concat(...text.map(content => content.split('\r\n').slice(6, -1).map(x => x.split(','))))
const EMAIL = 2
@benwaffle
benwaffle / Solution.java
Last active Nov 13, 2018
hackerrank triplets
View Solution.java
import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.*;
import java.util.regex.*;
import java.util.stream.*;
import static java.util.stream.Collectors.joining;
View bug.ts
type GraphQLType =
| GraphQLInt
| GraphQLList<any>
| GraphQLNonNull<any>;
interface GraphQLInt {
int: number
}
interface GraphQLList<T> {
View gist:66ccf69c2e09abb3584a4886f8a867fe
organization
- key: id
- views
- organization_reference
parameters
- organization_id=$id
View bt full.gdb
>>> thread apply all bt full
Thread 7 (Thread 0x7fffe5fbf700 (LWP 20826)):
#0 0x00007ffff612e6fd in pthread_cond_timedwait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
No symbol table info available.
#1 0x00007ffff4c6278c in dart::Monitor::WaitMicros (this=0x7fffd001e570, micros=<optimized out>) at ../../third_party/dart/runtime/vm/os_thread_linux.cc:449
ts = {
tv_sec = 20138,
tv_nsec = 348279925
}
View Makefile
CFLAGS += -Wall -Werror -pedantic -I../../include
LDLIBS += -L../../lib -llist -lmy
pipes: pipes.c
all: pipes
clean:
$(RM) pipes
View Makefile
CFLAGS += -Wall -Werror -pedantic -I../../include
LDLIBS += -L../../lib -llist -lmy
pipes: pipes.c
all: pipes
clean:
$(RM) pipes
View run.sh
#!/bin/bash
tests=$(cat testcases.txt)
tests=${tests//$'\n'$'\n'/$'\t'}
IFS=$'\t'
result=( $tests )
cnt=0
for x in ${result[@]}; do
You can’t perform that action at this time.