Skip to content

Instantly share code, notes, and snippets.

View UserAd's full-sized avatar

Konstantin Tumalevich UserAd

  • Almaty, Kazakhstan
View GitHub Profile
require 'rubygems'
require 'mp3info'
require 'logger'
require 'gdata'
#ARGV[0] - directory
#cover.jpg - cover
#description.txt - description for tracks
#tags.txt - tags
var sys = require('sys');
var redis = require('./lib/redis-client');
var ws = require('./lib/ws');
var clients = [];
var pubsub = redis.createClient();
pubsub.stream.addListener('connect', function(){
sys.debug('Connected to queue');
pubsub.subscribeTo("cargoboss:auction:*:bids", function(channel, data){
var auction_id = channel.toString().split(':')[2];
#! /bin/sh
### BEGIN INIT INFO
# Provides: cargoboss-node
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
var _ImagePreview = function() {
this.image = null;
this.image_object = new Image();
this.image_view = function(el,dest)
{
var imagefile = document.getElementById(el);
this.image = document.getElementById(dest);
// HTML5 FileAPI: Firefox 3.6+, Chrome 6+
if(typeof(FileReader)!='undefined')
{
module ActsAsAdmin
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
def acts_as_admin
layout lambda{ |c|
if c.request.xhr?
nil
@UserAd
UserAd / item.rb
Created September 17, 2010 16:14
class Item < ActiveRecord::Base
serialize :attrs
def method_missing(name, *args)
super
rescue NoMethodError
self.attrs = {} if self.attrs.nil?
if args.empty?
self.attrs[name.to_s]
else
class VeryBase
def self.attr_accessor(*vars)
@attributes ||= []
@attributes.concat vars
super(*vars)
end
def self.attributes
@attributes || []
end
declare -x LANG="ru_RU.UTF-8"
SSH_AGENT_PID=`ps x| grep ssh-agent | grep -v grep | awk '{print $1}'`;
if [ -n "$SSH_AGENT_PID" ]; then
export SSH_AGENT_PID;
SSH_AUTH_SOCK=/tmp/`ls --co=never /tmp | grep ssh`;
SSH_AUTH_SOCK=$SSH_AUTH_SOCK/`ls --co=never $SSH_AUTH_SOCK`;
export SSH_AUTH_SOCK;
else
eval `ssh-agent`;
@UserAd
UserAd / gist:1017451
Created June 9, 2011 19:00
Watermark remover
require 'rubygems'
require 'barracuda'
require 'RMagick'
include Magick
include Barracuda
prog = Program.new <<-'eof'
@UserAd
UserAd / fastagi.js
Created December 1, 2011 12:22 — forked from mheadd/fastagi.js
Node.js script to execute FastAGI application
// Include required modules.
var net = require('net');
var sys = require('sys');
// Create a TCP server and listen on FastAGI port.
var server = net.createServer();
server.listen(4573, '127.0.0.7');
// Add a listener for new connections.
server.addListener('connection', fastAGI);