Skip to content

Instantly share code, notes, and snippets.

View photex's full-sized avatar
🎸
I may be slow to respond.

Chip Collier photex

🎸
I may be slow to respond.
View GitHub Profile
@photex
photex / qtoscsocket.cpp
Created April 4, 2014 16:30
simple osc udp socket in qt5
#include <qtoscsocket.h>
#include <QtCore/qbytearray.h>
#include <QtNetwork/qhostaddress.h>
QOSCSocket::QOSCSocket(QObject *parent) : QUdpSocket(parent) {
connect(this, &QUdpSocket::readyRead,
[=] () {
while(hasPendingDatagrams()) {
QByteArray datagram;
<?xml version="1.0" encoding="UTF-8"?>
<style-scheme version="1.0" name="base16-ocean">
<style name="Text" foreground="#c0c5ce" background="#2b303b"/>
<style name="Link" foreground="#8fa1b3"/>
<style name="Selection" background="#4f5b66"/>
<style name="LineNumber" foreground="#65737e" background="#2b303b"/>
<style name="SearchResult" foreground="#2b303b" background="#ebcb8b"/>
<style name="SearchScope" background="#343d46"/>
<style name="Parentheses" foreground="#ebcb8b" background="#333333"/>
<style name="CurrentLine"/>
# This is a condensed snippet of making a python daemon manually.
# grizzled and python-daemon were simply not working as easily as
# I would expect, while this little bit of code works just fine.
# Assumes you've already used an OptionParser instance to get
# some info but that's easily modified.
if options.daemon:
# Fork once
pid = os.fork()
if pid > 0:
@photex
photex / strtest.c
Created January 19, 2011 15:54
see what happens
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char* argv[]) {
char *src="12345678";
char dst1[10];
char dst2[10];
// ensure that dst is clean
@photex
photex / prd-test.py
Created April 9, 2012 20:20
pycharm remote debug example
import sys
sys.path.insert(0, '/job/HOME/ccollier/pycharm/pycharm-debug.egg')
from pydev import pydevd
pydevd.settrace('localhost', port=1234)
# HERE YOU WOULD CALL THE CODE BEING DEBUGGED. A BREAKPOINT SHOULD BE SET IN PYCHARM
import akka.actor.ActorRef
import com.codahale.jerkson.Json.parse
import com.codahale.jerkson.ParsingException
import com.rabbitmq.client.{Channel, DefaultConsumer, Envelope}
import com.rabbitmq.client.AMQP.BasicProperties
class MsgConsumer(channel: Channel, target: ActorRef) extends DefaultConsumer(channel) {
override def handleDelivery(consumer_tag: String,
import play.api._
import play.api.libs.concurrent.Akka
import akka.actor.Props
import akka.routing.SmallestMailboxRouter
import com.typesafe.config.ConfigFactory
// whatever your package name is and whatever interested actors you want to target
import myapplication.amqp.{RabbitMQConnection, MsgConsumer}
import myapplication.actors.EventFilter
@photex
photex / plant
Created July 2, 2013 23:42
first version of the plant shellscript
#!/bin/zsh
if [ -d ".plant" ]; then
PROJECT=`basename $PWD`
COMMAND=$1
OPTIONS=$@[2,${#}]
else
COMMAND=$1
PROJECT=$2
if [ -d $PROJECT ]; then
@photex
photex / gnome-session-xmonad
Created April 29, 2012 17:05
Xmonad Ubuntu 12.04 Config
#! /bin/sh
exec gnome-session --session xmonad "$@"
@photex
photex / quick-glut.lisp
Created August 26, 2013 23:34
Template for quick and dirty OpenGL hacking with Common Lisp. Pan with the middle mouse button and zoom with the right mouse button.
(defclass viz-window (glut:window)
((zoom :initform 0.0025)
(offset :initform #(0.0 0.0))
(last-mouse :initform ())
(pan-throttle :initform 5)
(zoom-throttle :initform 0.00025)
(update-mode :initform nil))
(:default-initargs :pos-x 100 :pos-y 100
:width 800 :height 800
:mode '(:double :rgba)