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
<?xml version="1.0" encoding="UTF-8"?>
<nil-classes type="array"/>
FUCKING HELL
This shit is fucking broke!
_________________________
I am:
_ indifferent _ homicidal _ FUCKED
@phred
phred / app.py
Created February 18, 2013 20:05
Piece of crap web service for putting stuff on the clipboard. Hit /crap for some random Hipster Ipsum! Crap is a fun word. Oh yeah, and don't forget to pip install xerox (and flask)
import xerox, random
from flask import Flask, request
app = Flask(__name__)
@app.route("/crap")
def crap():
xerox.copy(random.choice(app.bucket))
return "Copying some randomly chosen crap to your clipboard!"
@app.route("/")
@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}'`
@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 / 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 / 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 / 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 / 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 / permalinks.conf
Created August 5, 2014 18:30
rewriting permalinks with nginx