Skip to content

Instantly share code, notes, and snippets.

@aji
aji / keybase.md
Created September 17, 2015 03:43

Keybase proof

I hereby claim:

  • I am aji on github.
  • I am aji (https://keybase.io/aji) on keybase.
  • I have a public key whose fingerprint is 3508 E751 97F2 22F2 EF44 3603 A06E 97DF 2CF8 2BB5

To claim this, I am signing this object:

@aji
aji / rcc.sh
Created February 18, 2012 06:09
rcc -- convert a file to a C array of unsigned integers
#!/bin/bash
# rcc.sh -- convert a file to a C array of uint16_t's
while getopts ":o:h:e:n:v" opt; do
case $opt in
o) output=$OPTARG
;;
h) header=$OPTARG
;;
e) varre=$OPTARG
@aji
aji / cycler.c
Created February 20, 2012 06:58
cycler -- cycles per time
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <time.h>
#define BUFSIZE 2<<15
char buforig[BUFSIZE];
char bufcopy[BUFSIZE];
@aji
aji / gist:1868454
Created February 20, 2012 08:41
chromeless -- send files on the filesystem to Chromium as text/plain
#!/bin/sh
# Chromium's default action for files it doesn't understand is to
# download them, apparently. Also, it looks like .c and other similar
# plaintext files are not something Chromium thinks it can read.
# So to save myself from having to constantly copy things to a file
# with a .txt extension so I can read them and to keep from having to
# make Chromium treat .c files and such differently, I've decided to
# write this nifty little script.
@aji
aji / brtcfg.c
Created February 24, 2012 05:16
brtcfg -- brightness configuration utility for my MacBook Pro running Arch
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
struct bclass {
char *id;
char *name;
char *brtfile;
char *maxfile;
};
@aji
aji / lastdl.sh
Created February 27, 2012 00:40
lastdl -- shell script to report the newest file in the downloads folder
#!/bin/sh
# echoes the full path of the newest download
# usage: lastdl.sh [NN], where 1<=NN<100
# adjust this appropriately:
DOWNLOADS=$HOME/Downloads
# this is horrendous
back=$1
case $back in
@aji
aji / killer.py
Created March 16, 2012 02:59
killer -- a deadly IRC "server"
#!/usr/bin/env python
import select
import random
import string
import socket
class Killer:
def __init__(self, sock):
self.sock = sock
@aji
aji / autojoiner.py
Created March 26, 2012 01:40
autojoin -- IRC bot to autojoin a channel and quit on a particular PRIVMSG. Does not respond to PING :/
#!/usr/bin/env python
import socket
import select
class AutoJoiner:
def __init__(self, server, port, nick, channel, deathmsg):
self.sock = socket.socket()
self.sock.connect((server, port))
@aji
aji / pinkie.py
Created April 13, 2012 19:29
IRC server in a single Python 3 script (only partially complete)
#!/usr/bin/python
# pinkie.py -- Proof-of-concept IRCd written in Python
# [40] alex@theta pinkie $ grep ^class pinkie.py
# class Pollable:
# class Timer:
# class TimerRepeat(Timer):
# class AsyncListen(Pollable):
# class AsyncLine(Pollable):
# class AsyncLoop: