Skip to content

Instantly share code, notes, and snippets.

View wridgers's full-sized avatar

Will Ridgers wridgers

View GitHub Profile
@mbinna
mbinna / effective_modern_cmake.md
Last active March 13, 2024 10:48
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@BenElgar
BenElgar / map.py
Created August 5, 2015 20:01
Static Maps Stitcher
import urllib, StringIO
from math import log, exp, tan, atan, pi, ceil
from PIL import Image
EARTH_RADIUS = 6378137
EQUATOR_CIRCUMFERENCE = 2 * pi * EARTH_RADIUS
INITIAL_RESOLUTION = EQUATOR_CIRCUMFERENCE / 256.0
ORIGIN_SHIFT = EQUATOR_CIRCUMFERENCE / 2.0
def latlontopixels(lat, lon, zoom):
@sts
sts / haproxy_maintenance.conf
Last active January 11, 2023 11:12
HAProxy Maintenance Page
#
# Proof of concept for a HAProxy maintenance mode
#
#
# Control the maintenance page during runtime using the stats socket:
#
# To put the whole site in maintenance mode (for all IPs):
# > add acl #0 0.0.0.0/0
#
# To exclude your own ip, so you are able to test things out:
@TomV
TomV / lcm-term.js
Last active December 17, 2015 22:19
Simple Terminal for Locomotive!
/**
* Simple script to invoke locomotive
* uses the jake-lcm module: https://npmjs.org/package/jake-lcm
*
* Just put this at the root of your locomotive app
*
* Date: 5/30/13
*
*/
@daniel-j
daniel-j / spotify.js
Last active January 6, 2024 04:19
A simple node.js program to listen to Spotify tracks, albums and playlists
#!/usr/bin/env node
'use strict';
/*
This is a simple Spotify cli-based client with optional Icecast2/shout support!
It should work for non-premium users, but you must connect your Spotify account to Facebook.
Usage:
$ node spotify <spotify uris> <playlist uri> <album uri> <track uri> <etc...>
@wridgers
wridgers / gist:3086828
Last active October 7, 2015 01:57
My vim keyboard reference file
-------- vim-commands ----------------------------------------------------------
// BASIC CONTROL
hjkl - move
i - insert mode
R - replace mode
o - insert new line below
O - insert new line above
// LINE MOTIONS
0 - start of line
@wridgers
wridgers / dtm.c
Created March 28, 2012 23:41
a pretty small c deterministic turing machine
// could probably be much smaller given some work.
// compressed version
#include <stdio.h>
#define w while
#define b break
int i,j;char s='S',d[]="S0a0>S1a0>a0a0>a1a0>a-H--";struct t{t*l;t*r;char v;};
int main(int c, char**v){t*h=0;w(v[1][j]){t*n=new t;n->v=v[1][j];n->l=h;n->r=0;if(h)h->r=n;
h=n;++j;}w(1){if(!h->l)b;h=h->l;}w(1){if(s=='H')b;i=0;w(d[i]){if(s==d[i]&&h->v==d[i+1]){
s=d[i+2];h->v=d[i+3];t*m=new t;m->v='-';if(d[i+4]=='<'){if(!h->l){m->l=0;m->r=h;h->l=m;}
@aemkei
aemkei / LICENSE.txt
Last active October 28, 2023 16:42 — forked from 140bytes/LICENSE.txt
Binary Tetris - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@wridgers
wridgers / rules.txt
Created December 10, 2011 18:18
Rules for C/C++ Turing Machine contest
-- RULES --
~ should be a single .c or .cpp file
~ must be written in C or C++ (C is a subset of C++)
~ entry must compile (of course)
~ must be a deterministic 1-tape TM as defined below
~ should accept the input string as a command-line argument (see Links for how to do this)
~ upon input, the program should output state:tape followed by a new line
~ the program should terminate once the state becomes H,Y, or N.
~ the delta function should be changeable (no hard coding the procedure!)
~ submissions should have a 'default' delta function that reverses the input string
@wridgers
wridgers / muttrc
Created May 16, 2011 18:32
mutt rc dotconfig, colours and transparent background!
---------------------------------------------------------------
~/.mutt/muttrc
---------------------------------------------------------------
color hdrdefault cyan default
color attachment yellow default
color header brightyellow default "From: "
color header brightyellow default "Subject: "
color header brightyellow default "Date: "