Skip to content

Instantly share code, notes, and snippets.

Noah Petherbridge kirsle

Block or report user

Report or block kirsle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kirsle
kirsle / .gtkrc-2.0.md
Created Dec 21, 2014
GTK Config for the panel text color on the XFCE Desktop
View .gtkrc-2.0.md

Save this code as ~/.gtkrc-2.0 and restart your XFCE panel with xfce4-panel -r

This file will set your panel text color to white (overriding the color setting from your current GTK theme). Change the #FFFFFF to another color if you want another color.

The engine "murrine" part will remove the text style for Murrine based themes (for example, a drop-shadow effect used in the Ubuntu Ambiance theme and Greybird).

style "panel"
{
    fg[NORMAL] = "#FFFFFF"
@kirsle
kirsle / Motivational Speech Alarm Clock.md
Last active Mar 16, 2018
Motivational Speech Alarm Clock with Raspberry Pi
View Motivational Speech Alarm Clock.md

Motivational Speech Alarm Clock

This is the code I used to make an alarm clock out of a Raspberry Pi (model 1 B+, 512MB RAM) that plays motivational speeches at 6:30 in the morning to get my ass out of bed.

At first I was using a CLI YouTube client, but it would hang after a while due to not running on an interactive console (being launched by crond), and the audio support on Pi's have always been somewhat flaky.

I ended up using youtube-dl to pre-download a playlist and using omxplayer for its hardware-accelerated decoding support. Works pretty well, except omxplayer has no support for things like "playlists" or "shuffling" so I needed

@kirsle
kirsle / nginx-custom
Created Jan 18, 2017
Rotate nginx per-user log files
View nginx-custom
/home/*/logs/*.log {
daily
missingok
rotate 14
size 50M
compress
delaycompress
notifempty
create 0640 www-data adm
sharedscripts
@kirsle
kirsle / .bashrc
Created Jan 17, 2017
Show current git branch name in Bash prompt
View .bashrc
# Function that prints the branch name.
git_branch() {
branch=`git branch 2> /dev/null | sed -e '/^[^*]/d' | perl -pe 's/^\*\s+//g'`
if [ "$branch" != '' ]; then
echo -n " ($branch)"
fi
}
# Integrate it into your $PS1 prompt.
# Would look like: [user@localhost myapp (master)]$
View keybase.md

Keybase proof

I hereby claim:

  • I am kirsle on github.
  • I am kirsle (https://keybase.io/kirsle) on keybase.
  • I have a public key whose fingerprint is 03AC B9F9 5CE5 A920 871E 94C5 9255 42ED E2E7 1CDA

To claim this, I am signing this object:

View twilio-rivescript.py
# minimal example of linking RiveScript to Twilio (untested)
from flask import Flask, request, redirect
from rivescript import RiveScript
import twilio.twiml
app = Flask(__name__)
bot = RiveScript()
bot.load_directory("brain")
bot.sort_replies()
View xclick.pl
#!/usr/bin/perl
# requires: libX11-devel, libXt-devel, libXtst-devel, /usr/bin/xinput
# sudo cpanm X11::GUITest
use threads;
use IO::Pty::Easy;
use IO::Handle;
use X11::GUITest qw(ClickMouseButton :CONST);
View Binary download.coffee
##
# Problem: sending a binary download in ExpressJS.
#
# I was trying to proxy download a binary file from S3 and serve it to the user with a different name.
# Using the `request` module didn't work; text files came back fine but binary files would be corrupted
# in strange ways (see attached diff).
#
# I ended up using the built-in `https` module and doing it the hard way.
#
# My theory: the request module expects to only work with text and was performing some UTF-8 coercion
View multiple-inheritance.py
#!/usr/bin/env python
class WorkerBase(object):
def __init__(self, *args, **kwargs):
print "WorkerBase init"
pass
class DBWorker(WorkerBase):
def __init__(self, *args, **kwargs):
print "DBWorker init"
@kirsle
kirsle / tcp-server.diff
Created Feb 22, 2015
RiveScript Node TCP Server with Logging
View tcp-server.diff
diff --git a/node/tcp-server.js b/node/tcp-server.js
index 22b383f..08e9c02 100644
--- a/node/tcp-server.js
+++ b/node/tcp-server.js
@@ -4,6 +4,7 @@
//
// Run this and then telnet to localhost:2001 and chat with the bot!
+var fs = require("fs");
var net = require("net");
You can’t perform that action at this time.