Skip to content

Instantly share code, notes, and snippets.

@dberkholz
dberkholz / gentoo_crostini_howto.txt
Last active July 20, 2019 21:14
HOWTO: Gentoo on ChromeOS Crostini
NOTE: STILL WORK IN PROGRESS
Based off:
- https://wiki.archlinux.org/index.php/Chrome_OS_devices/Crostini
- https://www.reddit.com/r/Crostini/wiki/howto/run-fedora-linux
- https://chromium.googlesource.com/chromiumos/docs/+/HEAD/containers_and_vms.md
Instead of Arch image, install "gentoo/current"
- Got an error message about how run_container.sh was deprecated
@dberkholz
dberkholz / 2017_possible_travel.md
Last active February 16, 2017 05:15
Donnie's potential trips for 2017 - none guaranteed

January

  • SF Jan 3-5

February

  • FOSDEM / cfgmgmtcamp
  • Santa Clara Feb 22-24

March

  • IBM InterConnect
@dberkholz
dberkholz / prepare_receipts.sh
Last active January 20, 2016 07:42
Takes an Excel spreadsheet, fetches URLs, annotates them with spreadsheet data and combines into a single PDF
#!/bin/bash
VERSION=0.3
help() {
echo "${0##*/} v${VERSION}"
echo
echo "${0##*/} makes expenses easier by handling receipt->PDF generation."
echo
echo "It creates an annotated PDF based on an Excel spreadsheet containing"
#!/bin/bash
for file in */*xls; do
echo ${file#*/}
in2csv --sheet 'Expense Report' $file \
| awk -F, '{if ($5 == "Mileage") {printf "%d\t%.2f\t%s (%.2f mi @ $0.56/mi)\n", $1, $6, $4, $6/0.56 }}'
echo
done
@dberkholz
dberkholz / census_scandinavian_fields.sh
Last active August 29, 2015 14:14
Finding Scandinavian fields in a census CSV
# The FPAT snippet allows for commas embedded within double-quotes.
# See https://www.gnu.org/software/gawk/manual/html_node/Splitting-By-Content.html
head -n2 nhgis0302_ds99_1970_state.csv | tail -n1 | awk 'BEGIN {FPAT = "([^,]*)|(\"[^\"]+\")"} {for (i=1;i<=NF;i++) {if ($i ~ /(Swed|Norw|Fin[nl]|Icela|Scand|Danish|Denm)/) print i, $i}}'
@dberkholz
dberkholz / cold.md
Last active August 29, 2015 14:13 — forked from kwhinnery/cold.md

How Winter Feels to Native Minnesotans

When I travel to San Francisco or similar warm climates, non-midwesterners have a hard time visualizing what a cold winter day in Minnesota feels like, or how we perceive and react to one. It turns out that there is a good metaphor for summing up how a Minnesotan feels about a given temperature: how we behave when we're inside and forget something in the car. Here's how we handle that situation in various temperatures. Units below are degrees Fahrenheit.

21 and warmer

Run out to the car and calmly grab the thing in whatever we happen to be wearing.

10 - 20

Run out to the car and grab the thing in whatever we happen to be wearing, but move quickly because it's kind of cold.

@dberkholz
dberkholz / timestamp_cluster_weekly.py
Last active August 29, 2015 14:11
Weekly clustering of timestamps with pandas
#!/usr/bin/env python
import pandas as pd, numpy as np
d = pd.read_table('input.txt', skiprows=0, header=None, parse_dates=True, index_col=0)
d['values'] = np.ones(len(d))
e = d.resample('w', how='sum')
f = e.fillna(value=0)
f.to_csv('output_weekly.txt', sep='\t')
#import matplotlib as mpl
Source,Target,SourceLabel,TargetLabel,Weight,Type
n1,n2,"age","compensation",0.217,Undirected
n1,n3,"age","job title",0.209,Undirected
n1,n4,"age","years of programming experience",0.466,Undirected
n4,n2,"years of programming experience","compensation",0.303,Undirected
n4,n3,"years of programming experience","job title",0.230,Undirected
n5,n3,"industry","job title",0.206,Undirected
n5,n6,"industry","number of employees at company",0.178,Undirected
n6,n7,"number of employees at company","size of team",0.255,Undirected
n6,n5,"number of employees at company","industry",0.178,Undirected