Skip to content

Instantly share code, notes, and snippets.

View leobessa's full-sized avatar

Leonardo Bessa leobessa

View GitHub Profile
@abh1nav
abh1nav / SqsSpout.java
Created February 1, 2013 07:28
A proper SQS spout for Storm
package com.crowdriff.engine.spouts;
import java.util.Map;
import java.util.concurrent.ConcurrentLinkedQueue;
import backtype.storm.spout.SpoutOutputCollector;
import backtype.storm.task.TopologyContext;
import backtype.storm.topology.OutputFieldsDeclarer;
import backtype.storm.topology.base.BaseRichSpout;
import backtype.storm.tuple.Fields;
@seanlilmateus
seanlilmateus / gist:4134454
Last active January 12, 2018 16:11
Rubymotion GCD Future; with lazy evaluation
#!/usr/bin/env macruby -wKU
framework 'Foundation'
module Dispatch
module Futuristic
def proxy
Class.new(BasicObject) do
def initialize(obj)
@obj = obj
end
@tlrobinson
tlrobinson / peepcode.rb
Created November 1, 2012 17:25 — forked from gertig/peepcode.rb
A script to download all Peepcode screencasts with ruby
#!/usr/bin/env ruby
require 'mechanize'
@username = USERNAME
@password = PASSWORD
@download_path = DOWNLOAD_PATH
unless File.directory? @download_path
puts "@{download_path} doesn't exist!"
@sakrist
sakrist / screenshot.mm
Last active August 28, 2020 06:21
Getting screenshot on iOS OpenGL ES
- (UIImage*) takePicture {
int s = 1;
UIScreen* screen = [UIScreen mainScreen];
if ([screen respondsToSelector:@selector(scale)]) {
s = (int) [screen scale];
}
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
@fnando
fnando / dnsimple_backup.rb
Created July 24, 2012 02:26
Backup your DNSimple records
# gem install dnsimple-ruby
# $ <SPACE>PASSWORD="your password" EMAIL="your e-mail" ruby dnsimple_backup.rb > dnsimple_backup.yml
# when you put a space before running a command you prevent it from being added to the history.
require "dnsimple"
require "yaml"
DNSimple::Client.username = ENV.fetch("EMAIL")
DNSimple::Client.password = ENV.fetch("PASSWORD")
@ParkinT
ParkinT / Rakefile
Last active October 7, 2015 07:18
RubyMotion Rakefile - improved workflow
# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project'
# custom rake tasks
require '../raketasks/gemerator.rb'
desc "Open latest crash log"
task :log do
app = Motion::Project::App.config
@lsauer
lsauer / gist:2907369
Last active January 17, 2022 09:59
Google Chrome special pages for memory, debug, resources, profiling, downloads...

####lsauer.com


###Overview of all chrome:// pages.

  • List by calling chrome://about/
  • Following is a direct dump from the 'about' page for reference

###List of Pages as per v20.xxx

@stonegao
stonegao / gist:2657252
Created May 11, 2012 03:06 — forked from mardambey/gist:2654382
Reset Kafka offsets in ZooKeeper by deleting the corresponding nodes.
/**
* Notes: This code uses AsyncValue[T], a custom class that uses actors
* to allow concurrent operations on the provided type. It can be replaced
* by an Atomic object from the java.util.concurrent package or something
* that provides similar functionality.
*/
/**
* Resets the offsets for the given group / topic pair.
@chetan
chetan / batch_em_http_example.rb
Created May 2, 2012 02:00
Example of batching requests using em-http-request
#!/usr/bin/env ruby
# This is an alternative to using EM::Iterator. It allows us to use
# MultiRequest but still limit the number of concurrent requests that
# are created.
require 'rubygems'
require 'eventmachine'
require 'em-http-request'
@jordandm
jordandm / amazon-linux-gems-19.erb
Created April 5, 2012 03:16
Chef Amazon Linux Boostrap File for Ruby 1.9.3 on AmazonLinux 2012.03
bash -c '
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
if [ ! -f /usr/bin/chef-client ]; then
yum groupinstall -y 'Development tools'
yum install -y libxml2-devel libxslt-devel
yum install -y ruby19 ruby19-devel rubygems19 rubygem19-rdoc rubygem19-rake rubygem19-bigdecimal
ln -sf /usr/bin/ruby1.9 /usr/bin/ruby
ln -sf /usr/bin/gem1.9 /usr/bin/gem
ln -sf /usr/bin/irb1.9 /usr/bin/irb