Skip to content

Instantly share code, notes, and snippets.

View paigeruten's full-sized avatar

Paige Ruten paigeruten

View GitHub Profile
  • Ore
    • Gem (Miner + Shovel)
      • Ring (Craftsman + Hammer)
    • Metal (Miner + Container)
      • Gear (Craftsman + Hammer)
        • Pocket Watch (Craftsman + Hammer)
        • Sewing Machine (Craftsman + Hook)
      • Statue (Artist + Hammer)
      • Compass (Fisherman + Hammer)
  • Worm
  1. The first number is the number of black squares in the row/column
  2. The second number is the number of "groups" of black/white squares in the row/column (see screenshots below)
@paigeruten
paigeruten / phi.php
Created August 30, 2009 08:34
look up php function synopses from the command line
#!/usr/bin/php
<?php
// v v
// \\O//
$RED = 31;
$GREEN = 32;
$BLUE = 34;
$MAGENTA = 35;
$CYAN = 36;
menu:
CLS
LOCATE 10, 30
PRINT "1) Try first two levels"
LOCATE 12, 30
PRINT "2) See New Features"
LOCATE 14, 30
PRINT "3) Quit"
PRINT
PRINT "Select your choice"

gzg

gzg helps you use git, tar, and gpg to keep a folder of text files synced across your devices using a server you have SSH access to. Each client has a git repo containing the unencrypted text files. All the server has is the encrypted, gzipped, tar'd, bare git repo in a single file called gzg.git.tar.gz.gpg. There is also a gzg.git.tar.gz.gpg.sha1 file used for the clients to check whether their version of the git repo is outdated.

Here's how you would set up a notes directory:

#include <stdio.h>
#include <unistd.h>
#include <termios.h>
int main() {
int i;
struct termios t;
tcgetattr(STDIN_FILENO, &t);
  1. Create a new file named kilo.c.
  2. Write a main() function that takes no arguments and returns 0.
  3. Create a Makefile that compiles kilo.c to kilo when you type make.
    • Use $(CC) for the compiler.
    • Turn on warnings using the -Wall -Wextra -pedantic options.
    • Turn on C99 mode using the -std=c99 option.
  4. In main(), Declare a char variable named c.
  5. Include <unistd.h>.
  6. Read a single byte from standard input into c repeatedly using read(), until read() returns an error or reaches the end of file.
@paigeruten
paigeruten / avconcat.rb
Created April 18, 2014 14:22
wrapper for a messy avconv command to concatenate audio files.
#!/usr/bin/env ruby
#
# Concatenates audio files together using avconv.
#
# Usage: avconcat -o <output> <inputs...>
#
output = nil
output_arg = false
@paigeruten
paigeruten / alarm.rb
Created October 30, 2013 05:09
a simple command line alarm clock, I use it to play some music when the alarm goes off.
#!/usr/bin/ruby
#
# Usage: ruby alarm.rb <time>
#
# <time> is either a number of seconds (e.g. "50"), minutes and seconds
# (e.g. "5:30"), or hours minutes and seconds (e.g. "7:30:00"). After the
# specified amount of time has passed, ring_alarm will be called and the
# program will exit.
#