Skip to content

Instantly share code, notes, and snippets.

View frozencemetery's full-sized avatar
🌲
I'll be at a place until a time.

Robbie Harwood frozencemetery

🌲
I'll be at a place until a time.
View GitHub Profile
@frozencemetery
frozencemetery / launch.py
Created October 13, 2015 18:11
Postgres server launcher so that I can pretend the server stays in the foreground
#!/usr/bin/env python3
import subprocess
import sys
def main(argv):
print(subprocess.getoutput("pg_ctl -D /var/lib/pgsql/data -l logfile start"))
try:
tail = subprocess.Popen(["tail", "-F", "logfile"], stdout=sys.stdout)
A: Trim the message, leaving appropriate context, then reply below.
Q: How should I reply to email then?
A: No.
Q: Should I include quotations after my reply?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in email?
@frozencemetery
frozencemetery / bright.sh
Last active August 29, 2015 14:10
Brightness control script for Intel and/or NVidia cards
#!/bin/sh
BASE=/sys/class/backlight/
FILE=/brightness
INTEL="${BASE}intel_backlight${FILE}"
NVIDIA="${BASE}nv_backlight${FILE}"
if [ -f "$INTEL" ]; then
echo $((4437 * $1 / 100)) > "$INTEL"
elif [ -f "$NVIDIA" ]; then
echo $1 > "$NVIDIA"
@frozencemetery
frozencemetery / rfcview.el
Created September 11, 2014 00:18
RFC viewing mode updated to obey fill-column
;;; rfcview.el -- view IETF RFCs with readability-improved formatting
;; Copyright (C) 2001-2002 Neil W. Van Dyke
;; Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc.
;; (mods by Dave Love <fx@gnu.org>)
;; Author: Neil W. Van Dyke <neil@neilvandyke.org>
;; Author: Dave Love <fx@gnu.org>
;; Version: 0.13
;; X-URL: http://www.loveshack.ukfsn.org/emacs/rfcview.el
@frozencemetery
frozencemetery / fml
Created August 13, 2014 03:17
FML/NJ, the FML of New Jersey, is a wrapper script for SML designed to be used in REPLs such as that of emacs.
#!/bin/sh
sml -Cprint.depth=10000 -Cprint.length=10000 -Cprint.string-depth=10000 $@
@frozencemetery
frozencemetery / random.c
Created July 26, 2014 21:58
Demonstration program that reads bytes from /dev/urandom
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
int main(int argc, char *argv[]) {
if (argc < 2) {
@frozencemetery
frozencemetery / asm-mode.el
Created April 21, 2014 02:00
Update asm-mode.el to respect tab-width
;;; asm-mode.el --- mode for editing assembler code
;; Copyright (C) 1991, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
;; Free Software Foundation, Inc.
;; All other changes in the public domain.
;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
;; Author: Robbie Harwood (frozencemetery) <rharwood@club.cc.cmu.edu>
;; Maintainer: FSF
@frozencemetery
frozencemetery / monty.c
Last active December 29, 2015 09:39
Monty Hall simulator.
/* tested with --std=c99 and --std=gnu99 using gcc 4.7.2 and clang 3.0 */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define ERROR(...) \
do { \
fprintf(stderr, __VA_ARGS__); \
fflush(stdout); \
exit(1); \
@frozencemetery
frozencemetery / lpr.sh
Created November 1, 2013 19:19
Quickly prints a (PDF/PS) file from another machine. Designed to avoid fighting cups.
#!/bin/sh
if [ $# != 2 ]; then
echo -n "syntax is: "
echo -n "$_"
echo "<file> <host>"
else
file="$1"
host="$2"
scp $file ${host}:/tmp
@frozencemetery
frozencemetery / oom.c
Created October 25, 2013 06:20
Code golfed C memory exhaustion.
main(){while(malloc(9));}