Skip to content

Instantly share code, notes, and snippets.

View bradenbest's full-sized avatar

Braden Best bradenbest

View GitHub Profile
@bradenbest
bradenbest / cppkill.h
Created January 18, 2022 00:18
C++ Killer
// cppkill - for when people won't stop attempting to compile your
// C code with a C++ compiler and complaining about compile errors
#ifndef CPPKILL_H
#define CPPKILL_H
#ifdef __cplusplus
#error This is C code, so please use a C compiler. Thanks :)
#endif
enum yes_this_is_valid_in_c_thank_you {
@bradenbest
bradenbest / cody-penn-2019-05-01.pdf
Last active May 1, 2019 20:58
Cody Penn Conversation 2019-05-01
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bradenbest
bradenbest / ins-sort-skinny.gif
Last active December 3, 2018 10:33
Animated Illustrations of Selection and Insertion Sort
ins-sort-skinny.gif
@bradenbest
bradenbest / magsq.c
Last active November 29, 2018 23:49
Magic Square Generator
/*
* https://gist.github.com/bradenbest/af3c83230e11cf1b5aaeb05598398df6
* magsq v1.0 by Braden Best, 2018
* Public Domain, no warranty.
*
* A simple program that calculates a magic square of order n.
*
* The cool part is that I did all of this with a flat "1D" array using the
* formula y * w + x to serialize a coordinate pair (x, y) as an array index,
* which technically makes this a hash table.
@bradenbest
bradenbest / needs-more-contrast.png
Last active May 19, 2018 18:48
fxn/vim-monochrome > issue #7 > images
needs-more-contrast.png
@bradenbest
bradenbest / 99b.dc
Created May 8, 2018 08:17
99 bottles of beer in dc (unix)
#!/usr/bin/dc
[
dc(1), or desktop calculator, is a unix program. It is one of the oldest, predating even the C programming language.
dc is slightly easier than brainfuck
----
This version of 99 bottles is pretty rudimentary and lacks proper punctuation
]c
100sg # register g: (int) 100
[ bottle(s) of beer]sh # register h: (str) " bottle(s) of beer"
@bradenbest
bradenbest / libflashplayer.so.bz2
Last active March 30, 2018 10:04
[linux] How to add flash to Firefox (in 2018)
This file has been truncated, but you can view the full file.
@bradenbest
bradenbest / mal-torrent.py
Created March 18, 2018 18:18
python/test/mal-interop-example
#!/usr/bin/env python3
# ^^^ IMPORTANT! Always make sure to specify which python. Can't tell you how many times I've had a python program break on me cause it *assumed* python 3 was my default. In fact, mal does that, too. I should probably open an issue on that.
# Note: this is a set of three fake program meant to demonstrate program interoperability. This does not actually torrent anything.
# This is meant to simulate passing 'mal torrent' as requested here:
# https://github.com/ryukinix/mal/issues/64
# this doesn't have to be marked executable. `python3 mal-torrent.py` should work also.
@bradenbest
bradenbest / input.js
Last active February 28, 2024 09:08
Input Helper Class
function Input(el){
var parent = el,
map = {},
intervals = {};
function ev_kdown(ev)
{
map[ev.key] = true;
ev.preventDefault();
return;
@bradenbest
bradenbest / convert
Last active December 11, 2016 04:27
Easy batch-converter for audio formats
#!/bin/bash
# Converts audio formats in bulk
# requires avconv
fformat=m4a
tformat=mp3
c=0
t=0
files=*.$fformat