Skip to content

Instantly share code, notes, and snippets.

View phred's full-sized avatar
🌴
On vacation

Fred Alger phred

🌴
On vacation
View GitHub Profile
@phred
phred / index.html
Created November 25, 2014 19:06
Prototyping an interaction for teaching command-line operations. The idea is "learn by doing", so the student must type the command approximately as written to continue.
<!DOCTYPE html>
<html>
<head>
<title>stripes</title>
<style type="text/css" media="screen">
#app {
font-family: sans-serif;
position: relative;
width: 80%;
}
#!/bin/bash
openssl x509 -in "$1" -noout -modulus | paste <( echo $1 ) <( shasum -a 256 )

Keybase proof

I hereby claim:

  • I am phred on github.
  • I am phred (https://keybase.io/phred) on keybase.
  • I have a public key whose fingerprint is A3FC DD18 E2CB 87F1 26FF A579 D9A2 4AC9 4F18 C669

To claim this, I am signing this object:

@phred
phred / permalinks.conf
Created August 5, 2014 18:30
rewriting permalinks with nginx
@phred
phred / test.php
Last active May 27, 2021 17:23
Using the phpmyadmin zip class to create a zip archive in memory from strings
<?php
require './zip.lib.php';
$templateData = array("cart" => "cart", "email" => "email");
$baseDir = "store_1234_templates"; // put the templates into this directory in the zipfile
$archive = new ZipFile();
foreach ($templateData as $name => $content) {
@phred
phred / cheerlights.py
Created December 31, 2013 02:54
2012–2013 Python/Raspberry Pi-powered cheerlights hack. See http://www.cheerlights.com/
#!/usr/bin/python
import zlib, base64, requests, time, os
known_colors = "red green blue cyan white warmwhite purple magenta yellow orange purple".split(" ")
def ho_ho_ho():
return zlib.decompress(base64.b64decode('eJzj0gUBWxBQAAMPR2fvSAUPfx9PF8fIYAW3IANfh'
'ZKMVOec0qSM/FK94lQFGADpAevmggsp6Onq6sWDCBCNhwEi4NriNeKhjEgiGJrxMI3R8fHxsSQxYDr1r'
'dQVYkhiQHXWWFmBSJIYUK0xVlZ6QMNIYgC1ZqUXQ7j6MEOIYsADV91WnSQGFwBnQmi8'))
@phred
phred / chub.go
Created December 31, 2013 02:49
Stupid little webserver for controlling my Raspberry Pi cheerlights/lirc remote. Rife with bad ideas (unbounded memory usage, passing inputs to shell commands, woo!), but works nicely and compiles beautifully to ARM using goxc.
package main
import (
"fmt"
"net/http"
"log"
"html"
"os/exec"
)
@phred
phred / notes.md
Created May 20, 2013 16:37
My notes from Web Afternoon (May 2013, Augusta GA)
  • Nowaday's being a generalist is more important than being a specialist.
  • Soft skills vs technical skills
  • Schools traditionally focus on tech skill
  • Design work requires more soft skills -- Writing, design, communication, organization, planning, collaboration.

Sho moved away from a successful professorship to start a program to address those problems. She said, "It wasn't something that I wanted to do, it was something that I HAD to do."

@phred
phred / strobe.py
Created March 6, 2013 17:15
Blast out some commands to COM0, pausing every once and a while.
import sys, os, time
import serial
ser = serial.Serial(port='COM0',baudrate=115200, timeout=1)
# class TestSerial:
# def write(self, msg):
# print "GOT: " + msg
#
# ser = TestSerial()
@phred
phred / ssh.sh
Created February 26, 2013 18:58
vagrant ssh-config into shell command through the miracle of AWK. Ramen.
sh -c `vagrant ssh-config | awk 'BEGIN {ORS=" "; print "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no"} /Port/ {print "-p",$2} /IdentityFile/ {print "-i", $2} /User / {print "-l",$2} /HostName/ {host=$2} END {print host}'`