Skip to content

Instantly share code, notes, and snippets.

View sycobuny's full-sized avatar

Stephen Belcher sycobuny

  • Kelly Services, NIH/NIA
  • Baltimore, MD
View GitHub Profile
@sycobuny
sycobuny / crash.c
Created August 3, 2011 02:29
Simple program designed to crash. For some reason.
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv) {
char crash[16];
char* plz = "this is probably longer than 16 characters";
strcpy(crash, plz);
return 0;
@sycobuny
sycobuny / channel.rb
Created August 2, 2011 03:04
Cool DB stuff
def add_user_access(user, *flags_to_add)
# normalize arguments into a form we'll recognize
flags_to_add.collect! { |flag| flag.to_sym }
id = user.to_i
# backup our arguments in case we need to restore to them later
flags = user_flags(id)
flags_backup = flags.dup
flag_lookup_backup = {}
flags_to_add.each do |flag|
@sycobuny
sycobuny / capacity.php
Created June 19, 2011 15:09
Order Generator for Ria
<?php
require_once '.include/include.php';
class Capacity extends Selector
{
private $type;
private $capacity;
private $cost;
function Capacity($capacity, $type, $cost, $photo)
@sycobuny
sycobuny / FindMusic.pl
Created June 9, 2011 15:06
Pull files off my iPhone
#!/usr/bin/perl
####
# this script is not safe.
# don't expect it to sanitize your input; it doesn't.
# so don't use it on a web server or anywhere else someone untrusted can access
# it.
# it was designed to work on Linux Mint.
# it requires sqlite3 to be installed, and is invoked from the command line.
/*
* FUNCTION coleoptera.find_or_create_instructions(
* TEXT[] -- instruction labels
* )
* RETURNS coleoptera.instructions[]
*/
-- as plpgsql
CREATE OR REPLACE
FUNCTION coleoptera.find_or_create_instructions(IN TEXT[], OUT coleoptera.instructions[])
module Sequel
class Database
alias :old_synchronize synchronize
def synchronize(server=nil, &block)
ret = nil
old_synchronize(server) do |connection|
connection.exec("SET search_path = #{Coleoptera::SSP}")
ret = block.call(connection)
connection.exec("RESET ALL")