Skip to content

Instantly share code, notes, and snippets.

View afternoon's full-sized avatar

Ben Godfrey afternoon

View GitHub Profile
@afternoon
afternoon / rename_js_files.sh
Created February 15, 2014 18:04
Rename .js files to .ts
find app/src -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;
@afternoon
afternoon / helloworld.c
Created December 6, 2016 18:15
Hello world C -> LLVM IR -> GNU assembly
#include <stdio.h>
int main() {
printf("Hello World!\n");
}
@afternoon
afternoon / .zshrc
Created September 19, 2023 19:44
Lean and mean .zshrc
autoload -Uz compinit
compinit
alias ls="ls -F --color"
alias vi="/usr/local/bin/nvim"
PS1="
▶ %F{81}%U%~%u%f %F{8}$%f "
@afternoon
afternoon / git-slim.py
Created December 5, 2011 14:42
Remove large objects from a git repository
#!/usr/bin/python
#
# git-slim
#
# Remove big files from git repo history.
#
# Requires GitPython (https://github.com/gitpython-developers/GitPython)
#
# References:
# - http://help.github.com/remove-sensitive-data/
@afternoon
afternoon / dashboard.js
Created May 19, 2014 16:15
Show a report of progress on Jira epics from a rapid board
#!/usr/bin/env node
var request = require('request-promise'),
Table = require('cli-table');
var jiraUrl = 'http://jira.yourcompany.com', // change this
rapidViewId = 1, // get this from the rapid board URL
url = jiraUrl + '/rest/greenhopper/1.0/xboard/plan/backlog/epics?rapidViewId=' + rapidViewId,
interestingEpics = []; // add epic IDs to restrict what's included
var progressBar = function (percentageCompleted) {
#![no_std]
#![no_main]
use panic_probe as _;
mod microgroove {
mod sequencer {
use heapless::Vec;
use midi_types::{Channel, Note, Value14, Value7};
#include <Arduino.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define DISPLAY_WIDTH_PX 128
#define DISPLAY_HEIGHT_PX 64
#define DISPLAY_ADDRESS 0x3D
Adafruit_SSD1306 display(DISPLAY_WIDTH_PX, DISPLAY_HEIGHT_PX, &Wire);
#include <Arduino.h>
#include <RotaryEncoder.h>
#define PIN_IN1 2
#define PIN_IN2 3
RotaryEncoder encoder(PIN_IN1, PIN_IN2);
int lastPos = 0;
void setup() {
@afternoon
afternoon / rrdxml.py
Created April 28, 2011 20:45
Dump RRD XML to CSV
#!/usr/bin/env python
"""Export CSV from an RRD XML dump.
Usage: rrdxml.py file.xml rra
Where rra is the 0-based index for the RRA you want to dump.
"""
from csv import writer
from itertools import chain, izip
@afternoon
afternoon / jenkins-user-script.sh
Created October 4, 2012 23:09
User data script to spin up a Ubuntu-based Jenkins server on the EC2 clouds
#!/bin/bash
#
# User data script which sets up Jenkins on Ubuntu using Puppet
#
# For example:
#
# $ ec2-run-instances ami-5a19976a -t m1.small --region us-west-2 \
# --key ec2-keypair --user-data-file Desktop/jenkins-user-script.sh
# $ ssh -i ~/.ssh/ec2-keypair-us-west-2 \
# ubuntu@ec2-xxx-xxx-xxx-xxx.us-west-2.compute.amazonaws.com