Skip to content

Instantly share code, notes, and snippets.

@ajesler
ajesler / action-on-latest.rb
Created April 3, 2012 12:12
Shows the last unread or total number of missed skype messages. Windows only.
require 'thread'
class ActionOnLatest
attr_accessor :queue, :mutex, :val
def initialize
@queue = Queue.new
@mutex = Mutex.new
end
@ajesler
ajesler / sot-demo-consumer.rb
Last active December 20, 2015 22:09
SoT Demo: Consumer for SQS and sends message via Twilio
require 'rubygems'
require 'aws-sdk'
require 'twilio-ruby'
account_sid = ENV['twilio_account_sid']
auth_token = ENV['twilio_auth_token']
client = Twilio::REST::Client.new account_sid, auth_token
from = ENV['twilo_from_number']
@ajesler
ajesler / .gitconfig
Created December 13, 2013 02:13
My .gitconfig file
[user]
name = <NAME>
email = <EMAIL>
[credential]
helper = cache --timeout=43200
[core]
editor = nano
#pager = less -r
@ajesler
ajesler / junit-test-times.rb
Last active August 29, 2015 14:01
Sort JUnit test results.
require 'nokogiri' # swap to using REXML - may be slower but its built in to the ruby standard lib.
require 'optparse'
######################################
# called like 'ruby junit-test-times.rb /home/user/project/target/surefire-reports'
######################################
class JUnitTestTimes
@options = {}
@ajesler
ajesler / readme.md
Last active August 29, 2015 14:03
Translation practice based on grabbing tweets in the desired language and feeding through google translate and speaking the text.

Twitter Translation Practice

This project was conceived with the idea of getting some real world language practice.

Installation

  1. Install the required gems.
gem install google-translate
@ajesler
ajesler / led_lamp.ino
Last active November 13, 2016 20:51
Arduino sketch for a remote controllable LED lamp.
// IRLib from https://github.com/cyborg5/IRLib
#include <IRLib.h>
// RGBEffects from https://github.com/ajesler/Arduino-RGBEffects
#include <RGBEffects.h>
// if isPaused is true, update will stop being called until the lamp is unpaused.
int isPaused = 0;
// the time between effect updates.
int effect_delay = 2100;
@ajesler
ajesler / mbtiles.rb
Last active June 30, 2023 22:40
An mbtiles wrapper in ruby
require 'sqlite3'
# https://github.com/mapbox/mbtiles-spec/blob/master/1.1/spec.md
class Mbtiles
attr_reader :tile_format, :db_file_name
def initialize(db_file_name, format=:png)
@db_file_name = db_file_name
load_database(db_file_name)
@ajesler
ajesler / readme.md
Created July 20, 2015 07:53
wator simulator using ncurses
#define D3 3
#define SECONDS_PER_HOUR = 3600
const int photoresistorPin = D3;
const int impressionsPerkWh = 1000;
volatile long readingStart = 0;
volatile long readingEnd = 0;
volatile boolean readingAvailable = 0;
@ajesler
ajesler / cucumber_step_debugging.rb
Created March 22, 2016 04:32
Start of a helper for understanding cucumber specs
module CucumberStepDebugging
def print_step_definitions
step_definitions.each do |sdl|
puts "#{sdl.regexp_source} in #{sdl.file_colon_line}"
end
end
def step_definitions
language_map = @__cucumber_runtime.instance_variable_get("@support_code").instance_variable_get("@language_map")
step_definitions = language_map["rb"].instance_variable_get("@available_step_definition_hash").keys