Skip to content

Instantly share code, notes, and snippets.

View Noxn's full-sized avatar

Noxn Xon Noxn

  • None.
  • None either.
View GitHub Profile
@Noxn
Noxn / webapp.rb
Created November 15, 2010 20:53 — forked from igrigorik/webapp.rb
require 'rubygems'
require 'rack'
class Object
def webapp
class << self
define_method :call do |env|
func, *attrs = env['REQUEST_PATH'].split('/').reject(&:empty?)
[200, {}, send(func, *attrs)]
end
$ ruby TheSIGnal.rb ~/untz-untz.ogg # start music deamon
Started as 13561 
$ kill -s SIGSTOP 13561 # pause
$ kill -s SIGCONT 13561 # unpause

Note left by Noxn: Not tested because I lack rubygame and dont want it on my vps.

@Noxn
Noxn / daemontest.rb
Created October 24, 2010 14:39
Daemon Test
#Just put this at the start:
Process.daemon(nochdir=true) #nochdir=true prevents it from changing the directory to /
#Code used for testing, with running tail every few moments.
3.times do
sleep 3
File.open('test', 'a') {|f| f.write("YAY") }
end
require 'test/unit'
TDIR = "#{File.dirname(__FILE__)}"
require TDIR+'/lib'
require TDIR+'/client'
#Tests for lib.rb (Needs a name)
# Server.rb and Client.rb are needed for testing.
#The lone letters in test names are for order.
require 'rubygems'
require 'mini_magick'
require 'Win32API'
img = MiniMagick::Image.from_file("wallpaper.jpg")
#texty = "'Stuff'"
texty = "'#{gets.chomp}'"
img.combine_options do |c|
require 'rubygems'
require 'socket'
require 'mongo'
class Lurker
def initialize(channel, server, port, name)
#Make variables we will use.
@channel, @server, @port, @name = channel, server, port, name
end
require 'socket'
class Lurker
def initialize(channel, server, port, name)
#Make variables we will use.
@channel, @server, @port, @name = channel, server, port, name
end
def connect
#Create socket, send ident, name and other stuff.
#Connect to channel.
require 'socket'
class Lurker
def initialize(channel, server, name)
@channel, @server, @name = channel, server, name
end
def connect
#Create socket, send ident, name and other stuff.
#Connect to channel.
end
#!/usr/bin/ruby
# Made by Noxn. Stoopid.
# Arguments: ./filebot server port channel(without #) file
require "socket"
class Hurr
def initialize(host, port, channel, file)
@host, @port, @channel, @file = host, port, channel, file
raise "File does not exist." unless File.exists?(@file)
puts "//File Exists"