Skip to content

Instantly share code, notes, and snippets.

View tomfbush's full-sized avatar
🏠
Working from home

Tom Bush tomfbush

🏠
Working from home
View GitHub Profile
@tomfbush
tomfbush / TwitterClient.cs
Created December 2, 2022 21:21 — forked from sdesalas/TwitterClient.cs
An ultra-lightweight Twitter client in C# using OAuth
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Security.Cryptography;
using System.Linq;
using System.Text.RegularExpressions;
using System.Net;
using System.Web;
@tomfbush
tomfbush / emacs-cheat-sheet.md
Created July 15, 2022 08:50 — forked from dherman/emacs-cheat-sheet.md
My emacs cheat sheet

In penance for cracking stupid jokes on Twitter, here's my Emacs cheat sheet. Emacs has a steep learning curve, so I've tried to order them by importance so you could learn them in stages.

One overall rule of thumb: pay attention to the minibuffer (the line at the bottom of the editor). It will often guide you through a process, and also gives you hints about what state you're in, such as the middle of a multi-chord sequence.

The other rule of thumb: when in doubt, C-g it out.

Basics (mandatory)

You simply can't get by without having these at your fingertips.

@tomfbush
tomfbush / gist:285f2db050fb82a2ff85c867ffb9b775
Last active January 2, 2022 13:34
Search a path for a pattern in text files
# via https://stackoverflow.com/a/16957078/4421532
grep -rnw '/path/to/somewhere/' -e 'pattern'
@tomfbush
tomfbush / nb_remove_output.py
Created August 23, 2021 09:57 — forked from decabyte/nb_remove_output.py
Remove output from Jupyter notebook from the command line
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Remove output from existing Jupyter Notebooks.
Modified from remove_output by Minrk, damianavila, gabraganca.
References:
[0]: https://github.com/jupyter/nbformat
[1]: http://nbformat.readthedocs.org/en/latest/index.html
@tomfbush
tomfbush / clean.r
Created November 22, 2018 20:30
Clean a specific column
# function to substitute matching string and everything after it with nothing
# note leading space if that applies to your dataset
removeCrap <- function(crapThing) {
gsub(" (0|[1-9][0-9]*)\ ?(GB).*$", "", crapThing)
}
# load data from csv into a dataframe
d <- read.csv("input.csv", sep = ",")
# display a few rows of the dataframe 'd'