Skip to content

Instantly share code, notes, and snippets.

View scottstanfield's full-sized avatar
🚀
:wq

Scott Stanfield scottstanfield

🚀
:wq
  • Relativity Space
  • California
  • 13:24 (UTC -07:00)
View GitHub Profile
@scottstanfield
scottstanfield / apsw.md
Created September 5, 2015 19:13
APSW: a better sqlite shell

APSW: A better Sqlite3 shell

If you use sqlite3 as a shell to manage SQLite databases, then you might want to consider using [APSW][1], "Another Python SQLite Wrapper".

When run through the Python interpreter, the APSW library has an interactive shell, much like the one included with sqlite3, but with some added functionality like .autoimport. A list of [what APSW does better][2] can be found in the docs.

# Taken from: http://h2o-release.s3.amazonaws.com/h2o/rel-tibshirani/8/index.html
# The following two commands remove any previously installed H2O packages for R.
if ("package:h2o" %in% search()) { detach("package:h2o", unload=TRUE) }
if ("h2o" %in% rownames(installed.packages())) { remove.packages("h2o") }
# Next, we download packages that H2O depends on.
if (! ("methods" %in% rownames(installed.packages()))) { install.packages("methods") }
if (! ("statmod" %in% rownames(installed.packages()))) { install.packages("statmod") }
if (! ("stats" %in% rownames(installed.packages()))) { install.packages("stats") }
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
cp /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
yum -y update
yum -y install git zsh tree make tmux
yum -y install R
@scottstanfield
scottstanfield / -
Last active March 14, 2016 22:14
unencrypt ubuntu home folder temporarily for ssh keys
$ /sbin/umount.ecryptfs_private
$ cd $HOME
$ chmod 700 .
$ mkdir -m 700 .ssh
$ chmod 500 .
$ echo $YOUR_REAL_PUBLIC_KEY > .ssh/authorized_keys
$ ecryptfs-mount-private
@scottstanfield
scottstanfield / convertOM2OSXTags.sh
Created May 2, 2016 03:51 — forked from code2k/convertOM2OSXTags.sh
This script converts OpenMeta to OS X Mavericks tags.
#!/bin/bash
#
# This script converts OpenMeta to OS X Mavericks tags.
#
# http://code2k.net
#
# Copyright © 2013 CODE2K:LABS. All Rights Reserved.
mdfind "kMDItemOMUserTags == *" -onlyin "." | while IFS= read -r file; do
echo "$file"
@scottstanfield
scottstanfield / osx-defaults.sh
Created July 18, 2016 03:40
Lots of OSX defaults
#!/bin/sh
# 90% from http://mths.be/osx
# ask for admin password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
@scottstanfield
scottstanfield / caps-to-ctrl.macos.sh
Last active October 26, 2016 15:34
map capslock to control on macOS
#!/usr/bin/env bash
# The purpose of this script is to simply turn the CAPS LOCK key into a CONTROL key.
# Does the same thing as System Preferences | Keyboard | Modifier Keys...
# I modified from https://github.com/mathiasbynens/dotfiles/issues/310
# Added the ioreg vendor/product code lookup for current keyboard,
# instead of hardcoding one. This might only work for the onboard keyboard.
# Delete old keyboard.modifiermapping entries first
@scottstanfield
scottstanfield / -
Created July 18, 2016 04:49
temporary
###############################################################################
# Disable caps lock #
###############################################################################
# Delete old entries first
# Normally these do not have an entry for com.apple.keyboard.modifiermapping.*
# Sometimes there is more than one (maybe caused by upgrade?)
old_ifs="$IFS"
export IFS=$'\n'
for plist in ~/Library/Preferences/ByHost/.GlobalPreferences.*.plist; do
keys=$(/usr/libexec/PlistBuddy -c 'Print' "$plist" | egrep 'com\.apple\.keyboard\.modifiermapping.[0-9]' | awk '{ print $1 }')
@scottstanfield
scottstanfield / 5-letter-colors.txt
Created September 21, 2016 21:34
A set of 5-letter colors, from A-Z
amber
black
cedar
denim
ebony
folly
grape
hazel
ivory
jaffa
#!/bin/sh
# abort if we're already inside a TMUX session
[ "$TMUX" == "" ] || exit 0
# startup a "default" session if non currently exists
# tmux has-session -t _default || tmux new-session -s _default -d
count=`tmux ls 2> /dev/null | wc -l`
echo $count