Skip to content

Instantly share code, notes, and snippets.

View bkutil's full-sized avatar

Balázs Kutil bkutil

View GitHub Profile
@bkutil
bkutil / deploy.rb
Created December 4, 2011 22:22 — forked from andruby/deploy.rb
Start and Stop tasks for resque workers and resque scheduler with capistrano deploy hook (without God)
after "deploy:symlink", "deploy:restart_workers"
after "deploy:restart_workers", "deploy:restart_scheduler"
##
# Rake helper task.
# http://pastie.org/255489
# http://geminstallthat.wordpress.com/2008/01/27/rake-tasks-through-capistrano/
# http://ananelson.com/said/on/2007/12/30/remote-rake-tasks-with-capistrano/
def run_remote_rake(rake_cmd)
rake_args = ENV['RAKE_ARGS'].to_s.split(',')
@bkutil
bkutil / app.rb
Created January 28, 2017 17:06
tiny sinatra app for testing
#!/usr/bin/env ruby
require 'sinatra'
warn Process.pid
get '/' do
'hi'
end
@bkutil
bkutil / test.js
Created October 7, 2016 20:45
opal #1270
/* Generated by Opal 0.10.0.dev, indentation fixed manually */
/* source: a = true ? 2 : 0 rescue 10 */
(function(Opal) {
Opal.dynamic_require_severity = "error";
var OPAL_CONFIG = { method_missing: true, arity_check: false, freezing: true, tainting: true };
var $a, self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, a = nil;
return a = (function() {
try {
(function() {
@bkutil
bkutil / import
Last active July 6, 2016 13:34
Import ledger transactions to local elastic search instance
#!/usr/bin/env ruby
require 'csv'
require 'elasticsearch'
require 'securerandom'
file = ARGV.shift
unless file
warn "Usage: $0 <ledger file>"
require 'spec_helper'
describe "A method stub" do
def decorate(klass, scope)
klass.class_eval <<-EOF
#{scope}
def some_stubbed_method
end
@bkutil
bkutil / Duinode.ino
Created April 7, 2014 08:07
Arduino sketch for duinode reporting voltage and temperature
#include <SPI.h>
#include <avr/sleep.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
RF24 radio(8, 7);
int led = 3;
int temp = A2;
var camera, scene, renderer;
var geometry, material, mesh;
init();
animate();
function init() {
camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 10000 );
camera.position.z = 300;
@bkutil
bkutil / ga.rb
Created March 18, 2013 08:56
Wrapper around Gabba to report events in background using Sidekiq's delay.
class GA
def self.track(type, args, cookies = nil, request = nil)
begin
self.delay(:queue => :analytics).track_send(type, args, cookies, request)
rescue Redis::CannotConnectError => e
Rails.logger.error e.message + "\n" + e.backtrace.join("\n")
end
end
private
@bkutil
bkutil / Excel.php
Created October 2, 2012 17:15 — forked from ihumanable/Excel.php
Simple Excel Writer in PHP
<?php
/**
* Simple excel writer class with no external dependencies, drop it in and have fun
* @author Matt Nowack
* @license Unlicensed
* @version 1.0
*/
class Excel {
private $col;
@bkutil
bkutil / dead_models.rb
Created August 24, 2012 08:39
Simple script for scanning a file for possible model references, then filtering out those which no longer exist in app/models.
#!/usr/bin/env ruby
require 'rubygems'
require 'machete'
rails_root = ARGV[0]
file = ARGV[1]
if rails_root.nil? || !File.exists?(rails_root) || file.nil? || !File.exists?(file)
warn "Usage: dead_models <rails root> <source file>"