Skip to content

Instantly share code, notes, and snippets.

View jschaub30's full-sized avatar

Jeremy Schaub jschaub30

View GitHub Profile
@jschaub30
jschaub30 / install_docker.sh
Last active December 12, 2020 18:46
Installing docker client and setting remote context on apple M1 silicon
#!/usr/bin/env bash
# prerequisites: install homebrew and wget
# - see https://gist.github.com/jschaub30/4bd5264d36926dcec5712799b427dce4
# brew install wget
FN="docker-20.10.0.tgz"
[ ! -e $FN ] && \
wget https://download.docker.com/mac/static/stable/x86_64/${FN}
[ ! -e docker ] &&
@jschaub30
jschaub30 / install_homebrew.sh
Created December 12, 2020 18:42
Install homebrew in /opt/homebrew for apple M1 silicon
#!/usr/bin/env bash
sudo chown -R "$USER" /opt/homebrew
cd /opt
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
echo 'Add this to your shell:'
echo 'export PATH=/opt/homebrew/bin:$HOME/bin:$PATH'
@jschaub30
jschaub30 / tidy_interrupts.sh
Last active April 27, 2016 19:10
Bash script to convert /proc/interrupts to csv format
#!/bin/bash
[ $# -ne 1 ] && echo USAGE: $0 INTERRUPTS_FN && exit 1
FN=$1
NUM_CPU=$(cat /proc/cpuinfo | grep processor | wc -l)
head -n 1 $FN | perl -pe "s/^/queue/" | perl -pe "s/\h+/,/g" | perl -pe "s/$/label/" > ${FN}.csv
grep "[0-9]:" $FN | perl -pe "s/ *([0-9]+):\s+/\1,/" | perl -pe "s/\h+/,/g" > ${FN}.tmp
cut -d',' -f1-$((NUM_CPU+1)) ${FN}.tmp > ${FN}.tmp1 # data
@jschaub30
jschaub30 / blog_notifier.py
Last active October 22, 2015 18:40
Python script to email users tagged in blogs/comments of a Wordpress blog
#!/usr/bin/python
import sys
import feedparser
import smtplib
import datetime
import time
import requests
from bs4 import BeautifulSoup
from email.mime.text import MIMEText
@jschaub30
jschaub30 / set_cpu_freq.sh
Created August 27, 2015 19:40
shell script to set cpu frequency to max on power machines
#!/bin/bash
echo Setting CPU to performance
for c in $(seq 0 8 192)
do
sudo cpufreq-set -c $c -r -g performance
done
@jschaub30
jschaub30 / .eslintrc
Last active September 1, 2015 15:52
Eloquent javascript solutions
{
"ecmaFeatures": {
"blockBindings": true
},
"rules": {
"semi": 2,
"no-console": 0
},
"globals": {
"console": true
@jschaub30
jschaub30 / gml2json.py
Last active June 1, 2021 02:38
Python script for converting graphml (*gml) files to json
#!/usr/bin/env python
import sys
def gml_sub(blob):
lines = []
for line in blob.split('\n'):
line = line.strip()
lines.append(line)
@jschaub30
jschaub30 / README.md
Last active August 29, 2015 14:26
GISTEMP data visualization

GISTEMP data visualization

This surface temperature data since 1880, from NASA's GISTEMP website, shows a warming trend over the past few decades.

Click on the buttons to show or hide global, northern hemisphere and southern hemisphere data, and to show the relative or absolute temperature in degrees.

@jschaub30
jschaub30 / csv2html.sh
Last active December 1, 2015 22:03
Shell scripts to test IO bandwidth
#!/bin/bash
[[ $# -ne 1 ]] && echo Usage: $0 [CSV_FN] && exit -1
CSV_FN=$1
echo "<table>"
head -n 1 $CSV_FN | \
sed -e 's/^/<tr><th>/' -e 's/,/<\/th><th>/g' -e 's/$/<\/th><\/tr>/'
tail -n +2 $CSV_FN | \
sed -e 's/^/<tr><td>/' -e 's/,/<\/td><td>/g' -e 's/$/<\/td><\/tr>/'