Skip to content

Instantly share code, notes, and snippets.

@WilliamBundy
WilliamBundy / twitch.sh
Last active December 16, 2015 15:48
A short shell script for streaming with twitch.tv on linux. Requires avconv. Make a file called .twitch_key in the same directory as your script and store your twitch key in there.
#! /bin/bash
# these 3 lines need to be configured for your streaming area
TOPXY="1680,24"
INRES="1920x1056"
OUTRES="852x480"
FPS="30"
QUAL="medium"
STREAM_KEY=$(cat ~/.twitch_key)
avconv -f x11grab -s $INRES -r "$FPS" -i :0.0+$TOPXY -f alsa -ac 2 -i pulse -vcodec libx264 -s $OUTRES -preset $QUAL -acodec libmp3lame -ar 44100 -threads 4 -qscale 3 -b 712000 -bufsize 512k -f flv "rtmp://live.justin.tv/app/$STREAM_KEY"
@WilliamBundy
WilliamBundy / bunch.cs
Created June 1, 2015 03:53
Playing around with a more dynamic/JS style in C#
class Bunch : IEnumerable
{
public object this [string name]
{
get
{
try
{
return this.GetType().GetField(name).GetValue(this);
}
#!/usr/env python3
game = """
Quick--do you have an apple?
{switch}
{choice 1 "Yeah, I do"}
{choice 2 "*pats pockets* Nope"}
{case 1} {do "set({'apple'}, 'player', 'items')"} {goto "You run into John Appleseed"}
{case 2} {goto "You run into John Appleseed"}
@WilliamBundy
WilliamBundy / random.cpp
Created June 18, 2016 15:02
xorshift rng
#include <stdint.h>
typedef uint64_t uint64;
// Random number generators
static inline uint64 _splitmix64(uint64* x)
{
*x += UINT64_C(0x9E3779B97F4A7C15);
uint64 z = *x;
z = (z ^ (z >> 30)) * UINT64_C(0xBF58476D1CE4E5B9);
z = (z ^ (z >> 27)) * UINT64_C(0x94D049BB133111EB);
@WilliamBundy
WilliamBundy / .vimrc
Created June 19, 2016 19:08
My .vimrc
set nocompatible
behave mswin
call plug#begin('C:/Vim/vimfiles/bundle')
Plug 'tomasr/molokai'
Plug 'tpope/vim-surround'
Plug 'vim-scripts/a.vim'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'craigemery/vim-autotag'
" Plug 'vim-scripts/AutoComplPop'
/*
* rituals_simulation.cpp
*/
#define Flag(x) (1 << x)
#define Has_Flag(x, y) (x & y)
enum Sim_Body_Flags
{
Body_Flag_None,
// 1. use List.Add, hope that .ToArray() works
List<string> temp = new List<string>();
temp.Add(desired_username_tb.Text);
temp.Add(new_password_tb.Text);
temp.Add(Email_tb.Text);
DB.login_DB.Add(temp.ToArray());
// 2. Use an array of strings
string[] temp = new string[3];
set nocompatible
behave mswin
call plug#begin('C:/Vim/vimfiles/bundle')
Plug 'tomasr/molokai'
Plug 'tpope/vim-surround'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'craigemery/vim-autotag'
Plug 'tikhomirov/vim-glsl'
call plug#end()
@WilliamBundy
WilliamBundy / .vimrc
Created October 25, 2016 00:36
My vimrc as of 10/24/16
set nocompatible
behave mswin
call plug#begin('C:/Vim/vimfiles/bundle')
Plug 'tomasr/molokai'
Plug 'tpope/vim-surround'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'craigemery/vim-autotag'
Plug 'tikhomirov/vim-glsl'
Plug 'Raimondi/delimitMate'
/*
A memcpy replacement; uses SSE2 and _mm_lddqu_si128 from SSE3
It's okay, I guess.
Abuses rep movsb for sizes > 1024b and < 2mb--
--might not work very well on pre Sandy Bridge Intel or AMD in general.
On Skylake, it's about as fast as Microsoft's implementation.
Written by William Bundy