Skip to content

Instantly share code, notes, and snippets.

main: main.o lib.o
gcc -o main main.o lib.o
main.o: main.c
gcc -c main.c
lib.o: lib.c
gcc -c lib.c
#!/usr/local/bin/ruby
# Perhaps the most dangerous irc bot.
# To use it, edit the file to have the irc server and channel of your choice
# launch it with ruby. Don't worry about it. You should launch 2, just in case.
$version = 0.1
require "socket"
#require 'lib/irc'
#require 'lib/general.rb'
#!/usr/bin/ruby
$factoids = {
"ping" => "pong"
}
def get_factoid(channel, msg)
msg = msg.downcase
# if $factoids[msg].exists?
puts "Factoid: #{$factoid[msg]}"
send("PRIVMSG #{channel} #{$factoids[msg]}")
# end
when /^:(.+?)!(.+?)@(.+?)\sPRIVMSG\s(.+)\s:!(.+)$/i
message = $5.split(" ")
puts message.join("|") if $DEBUG
body = global_process(message)
body = body.split("\n")
puts "$1 #{$1} $2 #{2} $3 #{$3} $4 #{$4} $5 #{$5}"
body.each do |b|
puts "B| #{b}"
send("PRIVMSG #{}")
end
@atamis
atamis / chronology.rb
Created November 3, 2010 00:30
A ruby DSL for making timelines.
require 'date'
module Chronograph
class Timeline
include Enumerable
class Event < Struct.new(:name, :date, :desc)
attr_accessor :name, :date, :desc
def initialize(name, date, desc)
raise TypeError.new("date must be a date") unless date.is_a? Date
@atamis
atamis / url_shortener.rb
Created August 2, 2011 17:40
A simple URL shortened in Sinatra with Mongoid.
require 'sinatra'
require 'mongoid'
configure do
Mongoid.configure do |config|
name = "url_shortener"
host = "localhost"
config.master = Mongo::Connection.new.db(name)
config.persist_in_safe_mode = false
@atamis
atamis / errors.sh
Created September 5, 2011 17:45
Errors faced when attempting to compile https://github.com/FalconNL/mc2obj
$ ghc mc2obj.hs
mc2obj.hs:10:0:
Failed to load interface for `ObjExport':
Use -v to see a list of the files searched for.
$ ghc ObjExport.hs
ObjExport.hs:63:17:
Couldn't match expected type `BC.ByteString'
against inferred type `bytestring-0.9.1.7:Data.ByteString.Internal.ByteString'
@atamis
atamis / soundMeter.pde
Created January 14, 2012 01:08
Arduino volume monitor
int analogPin = 0; // potentiometer wiper (middle terminal) connected to analog pin 3
// outside leads to ground and +5V
int writePin1 = 2;
int writePin2 = 3;
int writePin3 = 4;
int writePin4 = 5;
int writePin5 = 6;
int writePin6 = 7;
int val = 0; // variable to store the value read
@atamis
atamis / gist:1734331
Created February 4, 2012 01:38
Polaris pilotlog
EV Nova pilot data dump
Output on 2/3/2012 at 5:37 PM
Game version: 1.1.1
Plugins loaded:
none
Pilot name: Goroth Obarskyr
@atamis
atamis / install_rails.sh
Created April 12, 2012 04:25
Quick and simple install script for nginx, passenger, and rails
#!/bin/bash
# Gotta get me some colors
echo "Updating package listing"
sudo apt-get update
echo "Installing packages"
sudo apt-get install -y curl git-core build-essential bison \
openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev \