Skip to content

Instantly share code, notes, and snippets.

Tim Lossen tlossen

Block or report user

Report or block tlossen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tlossen
tlossen / siberite_demo.rb
Created Jan 23, 2017
playing around with the siberite ruby client
View siberite_demo.rb
require 'siberite-client'
prefix = ARGV[0]
Thread.new do
queue = Siberite::Client.new('localhost:22133', 'localhost:22144')
i = 0
loop do
i += 1
item = "#{prefix}#{i}"
@tlossen
tlossen / UQuery.cs
Created Jun 25, 2015
uquery is like jquery, but for the unity 4.6 ui elements. sort of.
View UQuery.cs
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class UQuery : MonoBehaviour
{
protected GameObject GO(GameObject go, params int[] indexes) {
return GO(go.transform, indexes);
}
@tlossen
tlossen / redis_swarmd.rb
Created Oct 18, 2012
redis swarm daemon (proof-of-concept implementation)
View redis_swarmd.rb
#!/usr/bin/env ruby
require 'socket'
require 'thread'
require 'set'
REDIS = ['localhost', 6379]
UDP = ['172.18.167.255', 7777]
WHITELIST = ['sadd', 'srem']
class SafeSet < Set
@tlossen
tlossen / xing.rb
Created Mar 30, 2012
extract emails from vcf file
View xing.rb
#! /usr/bin/env ruby
puts(open("vcards-XING.vcf").lines.map do |line|
$1.chomp if line =~ /^EMAIL.*:(.*)$/
end.compact.uniq.join(','))
@tlossen
tlossen / bunny.rb
Created Mar 7, 2012
cloby is magic!
View bunny.rb
require 'rubygems'
require 'cloby'
class Bunny < Clojure::Object
def initialize
@alive = true
end
def kill!
@alive = false
@tlossen
tlossen / example.rb
Created Feb 21, 2012
playing with cloby
View example.rb
require 'rubygems'
require 'cloby'
Ref = Java::clojure.lang.Ref
class Foo < Clojure::Object
attr_accessor :count
def initialize(count = 1)
@count = count
@tlossen
tlossen / diskstore_inspector.rb
Created Jan 24, 2012
parse redis diskstore files (which contain hashes)
View diskstore_inspector.rb
# encoding: UTF-8
# dependencies:
# - wget http://dist.schmorp.de/liblzf/liblzf-3.6.tar.gz
# - gem install lzfruby
require 'lzfruby'
require 'stringio'
class DiskstoreInspector
@tlossen
tlossen / id.rb
Created Dec 10, 2009
how to generate a unique id which can be validated to be authentic
View id.rb
require 'digest'
module Id
SECRET = 'nobody knows the trouble'
def self.generate
a = digest("#{Time.now.to_f}:#{rand}")
b = digest(SECRET + a)
id = a + b
You can’t perform that action at this time.