Skip to content

Instantly share code, notes, and snippets.

View rye's full-sized avatar
🦀
wranglin' Cow<T>'s

Kris Rye rye

🦀
wranglin' Cow<T>'s
View GitHub Profile
@rye
rye / formatting.patch
Created December 2, 2012 18:52
samercier/riversDiary formatting fix
From a4024c35295c0d7375ce87ff666f0dffe75f4aa1 Mon Sep 17 00:00:00 2001
From: Kristofer Rye <krye97@gmail.com>
Date: Sun, 2 Dec 2012 13:48:36 -0500
Subject: [PATCH] moved javascript code to /js/ directory
---
Diary.html | 6 +-
jquery-1.8.3.min.js | 2 -
jquery-ui-1.9.2.custom.min.js | 6 --
jquery.easing.1.3.js | 205 --------------------------------------
@rye
rye / defunct.sh
Created June 15, 2015 16:18
Print out a list of PID's that are defunct
#!/bin/sh
ruby -e "\"`ps -ef|grep \<defunct\>`\".split(/$/).each{|l|puts(l.match(/^(?<user>\w+)\W+(?<pid>\d+)\W+(?<ppid>\d+)/)[:pid])}"
@rye
rye / bezier.rb
Created May 7, 2015 17:45
A Ruby script to calculate Bézier curves.
require "matrix"
require "pry"
class Integer
# Method to compute binomial coefficient nCk (where n is this object,
# and k is some other integer.
def choose(k)
# n! / (n-k)!
top = (((self-k)+1)..(self)).inject(1, &:*)
require "net/http"
require "pry"
# Parameters for episode looping.
#
# Note that 404 seems to be reserved for whining.
MIN_EPISODE_NUMBER = 001
MAX_EPISODE_NUMBER = 417
FORMAT = ".ogv"
@rye
rye / example_command.md
Created February 12, 2015 02:48
An example command to grab images from a webcam.

Example Command

This is the example command that will take pictures periodically:

$ ffmpeg -f v4l2 -i {{device, e.g. /dev/video1}} -ss 0:0:2 -s 120x90 -vsync 2 -r 4 -updatefirst 1 stream.png
  • -f v4l2 uses the standard linux /dev/video decoder thing.
@rye
rye / ruby-xflux.rb
Last active August 29, 2015 14:14
A simple startup script for XFlux, written in Ruby, of course.
#!/usr/bin/env ruby
require "net/http"
require "json"
require "pry"
# Uncomment this line and put in your default location if
# you want to have a default location (in case of network
# errors).
# $default_latlon = [90.0, 90.0]
@rye
rye / streaming_server.rb
Created December 16, 2014 16:14
Messing around with HTTP Streaming responses.
require "date"
require "json"
require "sinatra"
require "time"
module StreamMessageFormatter
def self.format(object)
return JSON.generate(object) << "\r\n"
end
end
@rye
rye / print-request-body.patch
Created July 22, 2014 17:22
This patch to FReCon prints out the request body.
diff --git a/lib/frecon/server.rb b/lib/frecon/server.rb
index 5a524de..06b6435 100644
--- a/lib/frecon/server.rb
+++ b/lib/frecon/server.rb
@@ -13,6 +13,8 @@ module FReCon
before do
content_type "application/json"
+
+ p request.body.read.to_s
@rye
rye / kiosk-install.sh
Last active August 29, 2015 14:02
An installer for the Kiosk system for the WLCSC libraries.
#!/bin/sh
echo ">>>> Copying archive to home directory!"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cp $DIR/zz_config-diffs.tar.gz $HOME
echo ">>>> Changing to home directory!"
@rye
rye / wat.txt
Created June 23, 2014 14:10
lol wat
neonatestail
penrumings
unisi
gooproach
destoolsnant
lopdurablee
falsenalhen
govnobsis
intenlog
loottylows