Skip to content

Instantly share code, notes, and snippets.

View blbradley's full-sized avatar

Brandon Bradley blbradley

  • Nashville, TN
View GitHub Profile
@bishboria
bishboria / springer-free-maths-books.md
Last active March 22, 2024 11:19
Springer made a bunch of books available for free, these were the direct links
@justecorruptio
justecorruptio / 2048.c
Created April 4, 2014 03:49
Tiny 2048 in C!
M[16],X=16,W,k;main(){T(system("stty cbreak")
);puts(W&1?"WIN":"LOSE");}K[]={2,3,1};s(f,d,i
,j,l,P){for(i=4;i--;)for(j=k=l=0;k<4;)j<4?P=M
[w(d,i,j++)],W|=P>>11,l*P&&(f?M[w(d,i,k)]=l<<
(l==P):0,k++),l=l?P?l-P?P:0:l:P:(f?M[w(d,i,k)
]=l:0,++k,W|=2*!l,l=0);}w(d,i,j){return d?w(d
-1,j,3-i):4*i+j;}T(i){for(i=X+rand()%X;M[i%X]
*i;i--);i?M[i%X]=2<<rand()%2:0;for(W=i=0;i<4;
)s(0,i++);for(i=X,puts("\e[2J\e[H");i--;i%4||
puts(""))printf(M[i]?"%4d|":" |",M[i]);W-2
@aras-p
aras-p / preprocessor_fun.h
Last active April 12, 2024 17:24
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@jfryman
jfryman / gist:5808537
Created June 18, 2013 19:36
NagiosDB - Generate Nagios configs from Puppet Exported Resources + PuppetDB
#!/usr/bin/env ruby
#
# Nagios/PuppetDB config generator
#
# Based on concept from puppetdb-external-naginator
# https://github.com/favoretti/puppetdb-external-naginator
#
# Generates nagios configs from puppet(db) exported resources.
#
require 'rubygems'
@vinbarnes
vinbarnes / indentation_hell.rb
Last active December 14, 2015 19:19
I'd prefer the second way unless there's some weird Ruby reason why I shouldn't...
module My
module Job
class ReconcileAccounts
# ...
end
end
end
@jorendorff
jorendorff / censored.py
Last active December 13, 2015 22:49
Full script, minus comments, of the mystery program in this blog post: http://pynash.org/2013/02/19/English-playground.html
""" censored.py - Randomly ######## ############## ################## #####
#### ########## ## ### Brown Corpus.
To run this program without affecting your Python install:
mkdir mystery-program
cd mystery-program
wget https://gist.github.com/jorendorff/4987554/raw//censored.py
virtualenv venv
. venv/bin/activate
@jfryman
jfryman / personal_boxen_manifest.pp
Last active November 30, 2019 05:05
Personal Boxen Manifest
class people::jfryman {
# Applications
include chrome::stable
include onepassword
include dropbox
include alfred
include macvim
include zsh
include homebrew
include fitbit
@doobeh
doobeh / example.html
Last active April 19, 2022 10:25 — forked from anonymous/siecje.py
Simple example of using a RadioField in Flask-WTForms to generate a form.
<form method="post">
{{ form.hidden_tag() }}
{{ form.example }}
<input type="submit">
</form>
@jorendorff
jorendorff / json.hs
Last active December 11, 2015 14:09
data JSON = JSONNull
| JSONBool Bool
| JSONNumber Double
| JSONString String
| JSONArray [JSON]
| JSONObject [(String, JSON)]
deriving (Eq, Ord, Show)
@jameskoster
jameskoster / functions.php
Last active June 18, 2017 19:20
Change number of products per row in a WooThemes WooCommerce theme
// Override theme default specification for product # per row
function loop_columns() {
return 5; // 5 products per row
}
add_filter('loop_shop_columns', 'loop_columns', 999);