Skip to content

Instantly share code, notes, and snippets.

View bkutil's full-sized avatar

Balázs Kutil bkutil

View GitHub Profile
@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>"
#!/bin/bash
rm -rf $(pwd)/build
make clean
CFLAGS='-ggdb -g2 -gdwarf-2 -O0' ./configure --prefix=$(pwd)/build --disable-install-doc
make
make install
sudo ./build/bin/ruby -rsocket -e 'SIOCETHTOOL = 0x8946; i = ["lo", 10.chr].pack("a16p"); s = Socket.new(Socket::AF_INET, Socket::SOCK_DGRAM, 0); s.ioctl(SIOCETHTOOL, i); p i.unpack("a16p")[1]'
@bkutil
bkutil / gist:bbacd8e3d314721117d6
Created February 17, 2015 10:54
chybejici knihovny pri instalaci ruby
10:12 <qwebirc46419> LInux mint 17.1 , cista instalacia, ruby nainstalovane pomocou rbenv, verzia ruby 2.20, verzia rails 4.2.0, vytvorim novy projekt, spustim rails server a vyhodi chybu "6:
warning: already initialized constant APP_PATH", skusal som rozne riesenia, aj odinstalovat niektore gem, nepomohlo, skusal som prikaz "rake rails:update:bin", tiez bez
vysledku, , rake aborted ,LoadError: cannot load such file -- readline /home/blacknails/Doc
10:13 <qwebirc46419> a dalej sa neviem pohnut
10:14 <qwebirc46419> este raz cely vypis po rake rails:update:bin
10:14 <qwebirc46419> rake aborted! LoadError: cannot load such file -- readline /home/blacknails/Documents/PROJECTS/blog/config/application.rb:7:in `<top (required)>'
/home/blacknails/Documents/PROJECTS/blog/Rakefile:4:in `<top (required)>'
10:19 <bkutil> ruby ma zavislosti na -devel knihovnach - readline, openssl - mels je nainstalovane, kdyz jsi ho kompiloval?
10:19 <bkutil> https://gith
@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;
require 'spec_helper'
describe "A method stub" do
def decorate(klass, scope)
klass.class_eval <<-EOF
#{scope}
def some_stubbed_method
end
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;