Skip to content

Instantly share code, notes, and snippets.

View ruliana's full-sized avatar

Ronie Uliana ruliana

View GitHub Profile
@ruliana
ruliana / vagas.scss
Created August 28, 2015 20:52
SCSS para apresentação usando Reveal.js
/**
* A simple theme for reveal.js presentations, similar
* to the default theme. The accent color is darkblue.
*
* This theme is Copyright (C) 2012 Owen Versteeg, https://github.com/StereotypicalApps. It is MIT licensed.
* reveal.js is Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
*/
// Default mixins and settings -----------------
@ruliana
ruliana / Dockerfile
Created April 15, 2014 17:53
Dockerfile for Neo4J on Arch Linux
# Base Arch with base-devel and yaourt
FROM base/devel
MAINTAINER Ronie Uliana, ronie.uliana@vagas.com.br
# Installing Neo4J using Yaourt
RUN yaourt -Sy --noconfirm neo4j
RUN /usr/bin/sed -i.back 's/^#\(org\.neo4j\.server\.webserver\.address.*\)/\1/' /etc/neo4j/neo4j-server.properties
ENTRYPOINT ["/usr/bin/neo4j", "console"]
private
# Truque sujo para compilar um método com
# tail call optimization ligado :)
RubyVM::InstructionSequence.new(<<-RUBY, nil, nil, nil, tailcall_optimization: true, trace_instruction: false).eval
def separar_comuns(restantes, atual, resultado)
return resultado if restantes.empty?
primeiro, *resto = restantes
*_, ultimo= atual
@ruliana
ruliana / load_with_tco.rb
Created September 4, 2014 21:14
Load a ruby file compiling it with tail call optimization, with no effects in the rest of the system.
# Require a file compiling it
# with tail call optimization.
def load_with_tco(file)
def find(f)
filename = f + '.rb'
$LOAD_PATH.lazy.map do |path|
File.join(path, filename)
end.find do |path|
File.exist?(path)
end
@ruliana
ruliana / Guardfile
Created September 5, 2014 16:15
My guarfile
guard :rspec, cmd: 'bundle exec rspec', all_on_start: true, keep: true, all_after_pass: true, run_all: { cmd: 'bundle exec rspec -f progress' } do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
watch('lib/kremer.rb') { "spec" }
end
@ruliana
ruliana / time_lapse.sh
Created November 20, 2014 14:49
Photos => Time Lapse Video (GoPro with Linux and zsh)
# ZSH only
print -rl **/*(.Om) > frames.txt
mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell:autoaspect:vqscale=3 -vf scale=1920:1080 -mf type=jpeg:fps=24 mf://@frames.txt -o time-lapse.avi
@ruliana
ruliana / SMTP
Last active August 29, 2015 14:10
SMTP testing using telnet or ncat
# telnet localhost smtp
# ncat localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 fbreveal.com ESMTP Sendmail 8.13.8/8.13.8; Tue, 22 Oct 2013 05:05:59 -0400
>HELO yahoo.com
250 tecadmin.net Hello tecadmin.net [127.0.0.1], pleased to meet you
>mail from: sender@tecadmin.net
@ruliana
ruliana / local-http-file.sh
Created January 28, 2015 02:46
Serve a local file as http (once only)
{ echo -ne "HTTP/1.0 200 OK\r\nContent-Type:text/plain;Charset=utf-8\r\nContent-Length: $(wc -c <some.file)\r\n\r\n"; cat some.file; } | nc -l -p 8080
@ruliana
ruliana / faculdades_perto_de_metro_sp.html
Last active August 29, 2015 14:16
A Google API example of universities near subway
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="https://maps.googleapis.com/maps/api/js?libraries=places,geometry"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>
<body>
<div id="map"></div>
<h1>Universidades Próximas</h1>
@ruliana
ruliana / zeromq_sender.rb
Created May 25, 2015 02:01
Testing ZeroMQ (PUSH PULL) - clean shutdown - sender
require 'rbczmq'
class WorkerCommander
def initialize(sender_port = 5555, commander_port = 5556)
@ctx = ZMQ::Context.new
@sender = @ctx.socket(:PUSH)
@sender.bind("tcp://*:#{sender_port}")
@commander = @ctx.socket(:PULL)