Skip to content

Instantly share code, notes, and snippets.

View scottstanfield's full-sized avatar
🚀
:wq

Scott Stanfield scottstanfield

🚀
:wq
  • Relativity Space
  • California
  • 22:40 (UTC -07:00)
View GitHub Profile

App Install Plan

Critical

@miraculixx
miraculixx / markup.py
Last active April 12, 2023 17:13
an extensible multi-markup reader in less than 100 lines of python code
# (c) miraculixx, licensed as by the terms of WTFPL, http://www.wtfpl.net/txt/copying/
# License: DO WHATEVER YOU WANT TO with this code.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
from io import StringIO
from contextlib import contextmanager
@HackingGate
HackingGate / restore_last_git_modified_time.sh
Last active March 13, 2024 10:27
Retrieve and set the last modification date of all files in a git repository. Solution for https://stackoverflow.com/a/55609950/4063462
#!/bin/sh -e
OS=${OS:-`uname`}
if [ "$OS" = 'Darwin' ]; then
get_touch_time() {
date -r ${unixtime} +'%Y%m%d%H%M.%S'
}
else
# default Linux
@damoclark
damoclark / raspi-config.txt
Last active January 28, 2024 12:03
Simple Raspbian Configuration Tool. Add file to boot partition of SD Card and run single command after booting Raspbian.
#/bin/sh
#
# Don't change the following lines unless you know what you are doing
# They execute the config options starting with 'do_' below
grep -E -v -e '^\s*#' -e '^\s*$' <<END | \
sed -e 's/$//' -e 's/^\s*/\/usr\/bin\/raspi-config nonint /' | bash -x -
#
############# INSTRUCTIONS ###########
#
# Change following options starting with 'do_' to suit your configuration
@shackett
shackett / parallel_fread.R
Last active March 3, 2024 07:46
Parallelizing fread for fast file reading -- split a file into mc.cores pieces and then aggregate them
parallel_fread <- function(path, mc.cores = parallel::detectCores(), header = TRUE, ...) {
stopifnot(file.exists(path))
dots <- list(...)
fread_args <- dots[intersect(names(formals(fread)), names(dots))]
if (any(c("skip", "nrows") %in% fread_args)) {
stop(paste(intersect(c("skip", "nrows"), fread_args), collapse = " & "), " cannot be provided")
}
@scottstanfield
scottstanfield / .zshrc
Last active March 19, 2024 08:33
sensible, minimal .zshrc
# Sensible, short .zshrc
# Gist page: git.io/vSBRk
# Raw file: curl -L git.io/sensible-zshrc
# GNU and BSD (macOS) ls flags aren't compatible
ls --version &>/dev/null
if [ $? -eq 0 ]; then
lsflags="--color --group-directories-first -F"
else
lsflags="-GF"
@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active April 7, 2024 22:55
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@gomar
gomar / 00-intro.md
Last active January 30, 2024 04:58
Setting up a Keynote document for grid layout design

Setting up a Keynote document for grid layout design

I like (love ?) Keynote because it

  • is a simple to use presentation software,
  • is vector based (when zooming it just looks gorgeous)
  • exports to powerpoint

If I could remove that last argument, I would, but the fact is that, as a consultant, the final document is almost always expected to be a powerpoint document. Don't ask me why, it is just so. I am fighting against it but I did not win the battle so far ...

@hallettj
hallettj / Makefile
Last active December 10, 2023 13:32
Makefile for transpiling with Babel & Flow in a Node app, or in a client- or server-side shared library
# Makefile for transpiling with Babel in a Node app, or in a client- or
# server-side shared library.
.PHONY: all clean
# Install `babel-cli` in a project to get the transpiler.
babel := node_modules/.bin/babel
# Identify modules to be transpiled by recursively searching the `src/`
# directory.
@dannguyen
dannguyen / fec-indiv2016-simplified.md
Last active August 28, 2020 17:53
Walkthrough of how to download the massive FEC individual contributions file for 2016, and filter it for spreadsheet usage

Fitting 2016 FEC campaign donor data into your humble spreadsheet

The 2016 U.S. Election is so hot and rich that even with a month to go, the Federal Election Commission has recorded 12.6 million individual campaign donations.

image

For comparison's sake, the 2014 cycle had just 2.1 million donors. And the last presidential cycle, 2012, had 3.3 million donors.

The bottom line is that we can't import all the data directly into Excel (nevermind Google Sheets). But we can at least import the subset of data that we need (under a million rows) without having to crack out a database.