Skip to content

Instantly share code, notes, and snippets.

View cpu's full-sized avatar
❄️

Daniel McCarney cpu

❄️
View GitHub Profile
@cpu
cpu / keybase.md
Created March 7, 2014 04:53
Keybase Github Identity Claim

Keybase proof

I hereby claim:

  • I am binaryparadox on github.
  • I am cpu (https://keybase.io/cpu) on keybase.
  • I have a public key whose fingerprint is EA93 53F3 1EAA C378 B854 99AE 9599 2CFB 3537 3091

To claim this, I am signing this object:

@cpu
cpu / fuck_boingo.py
Created March 11, 2014 08:02
So you're stuck in an Airport overnight too huh?
#!/usr/bin/python
# Fuck Boingo. Fuck $7 wifi
# requests module is a non-optional dependency
# gntp is an optional dependency for Growl support
from os import sys
from random import randint
from shlex import split
from subprocess import check_call
@cpu
cpu / backgroundTile.sh
Last active August 29, 2015 13:57
Generate random p4m tile backgrounds with ImageMagick and feh.
#!/bin/bash
################################################################################
# About
################################################################################
#
# Dumb script to generate a random 100x100 tile in the p4m background group.
# Uses 'feh' to tile the image as a desktop background.
#
# Install to crontab -e to rengerate at a fixed interval. E.g. every 5 min:
@cpu
cpu / keybase.md
Created June 20, 2015 23:12
Keybase.io Github Proof

Keybase proof

I hereby claim:

  • I am ccppuu on github.
  • I am cpu (https://keybase.io/cpu) on keybase.
  • I have a public key whose fingerprint is EA93 53F3 1EAA C378 B854 99AE 9599 2CFB 3537 3091

To claim this, I am signing this object:

DROP TABLE IF EXISTS ipd_users;
DROP TABLE IF EXISTS ipd_associations;
DROP TABLE IF EXISTS ipd_logins;
DROP TABLE IF EXISTS ipd_logouts;
-- The table of usernames and their unique ID
CREATE TABLE ipd_users (
`id` INT NOT NULL auto_increment,
`username` VARCHAR(13),
PRIMARY KEY(`id`),
DROP VIEW IF EXISTS ipd_ips;
DROP VIEW IF EXISTS ipd_dested_players;
DROP VIEW IF EXISTS ipd_timeout_events;
DROP VIEW IF EXISTS ipd_player_replace_events;
DROP VIEW IF EXISTS ipd_quit_events;
DROP VIEW IF EXISTS ipd_in_out;
DROP VIEW IF EXISTS ipd_user_logouts;
DROP VIEW IF EXISTS ipd_user_logins;
DROP VIEW IF EXISTS ipd_pretty_associations;
DROP VIEW IF EXISTS ipd_ip_popularity;
DROP PROCEDURE IF EXISTS log_disconnect;
DROP PROCEDURE IF EXISTS log_connection;
DELIMITER //
-- The log_connection() procedure is called when a user connects to the game.
-- It accepts the username that is connecting, and the ip they are connecting
-- from. It then adds the user if their username is new, associates the
-- username with the IP making sure to update the count of how many times
-- they've connected from that IP. Finally it adds a login for this user at
-- the present time/date.
-- Selecting IPs used by a username
SELECT username, ip FROM ipd_pretty_associations WHERE username = '%s' ORDER BY count DESC;
-- Selecting usernames that have used a specific IP
SELECT ip, username, count, countryCode FROM ipd_pretty_associations WHERE ip = '%s'
ORDER BY count DESC;
-- Selecting usernames that have used a wildcarded IP
SELECT ip, username, count, countryCode FROM ipd_pretty_associations WHERE ip LIKE '%s'
ORDER BY count DESC;
@cpu
cpu / stayOnTarget.sh
Created April 13, 2011 18:16
A quick bash script to keep me from procrastinating
###
## Stay On Target!
## Daniel McCarney 2011
## https://binaryparadox.net
##
## Using an interactive countdown function found on the unix.com forums
## I created a shell function/alias that allows me to avoid procrastinating
## (if I procrastinate by writing code to stop procrastinating it equals out
## right?).
##
@cpu
cpu / gist:1276006
Created October 10, 2011 18:00
Python Twitter Avatar Downloader
###############################################################################
# Quick & Dirty script to download the Avatars of your Twitter Followers
# Daniel McCarney -- 10/10/11
#
# Emphasis on the quick & dirty. There's no error handling, and bad things
# are liable to happen if you have Twitter followers with malicious avatars
#
# Requirements: Python 2.6, python-twitter, OAuth keys*
#
# *Twitter requires OAuth authentication for the API calls this script uses.