Skip to content

Instantly share code, notes, and snippets.

leandromoreira /
Created February 6, 2014 02:03
It makes backup and purges it.
set -e
NOW=$(date +"%m-%d-%Y-%H-%M")
## Compacting and making backup
tar -zcf $DEST_FOLDER_BKP/bkp.$NOW.tar.gz $FOLDER_TO_BKP
leandromoreira / gist:9464594
Created March 10, 2014 13:01
random between 0 and 3
mov ax, dx
xor dx, dx
mov cx, 4
div cx ; here dx contains the remainder of the division - from 0 to 3
add dl, '0' ; to ascii from '0' to '3'
import sys
# from original author @jbochi
if len(sys.argv) != 2:
print "Usage: %s <filename>" % sys.argv[0]
with open(sys.argv[1]) as f:
chars =
leandromoreira /
Last active August 29, 2015 14:00
Speed Run Community Terms or Slangs
WR="world record, of a given game"
PB="personal best, of a given game for the current runner"
PR="personal record, vide PB"
split="sections of a game, how the speed runner tracks his time"
bingo="A run where given sections of a game, mount randomly a (finite) set of objectives"
SRL="the site speedrunlive where lots of speed runners stream"
race="to compete against another runner or team in the same game"
TAS="Tool Assisted Speedrun, usually by using an emulator"
blind="playing a game with no previous training"
urn="run, the run"


Install OpenJDK

sudo apt-get -y install openjdk-7-jdk
sudo mkdir /usr/java
sudo ln -s /usr/lib/jvm/java-7-openjdk-amd64 /usr/java/default

Install Tomcat

leandromoreira / gist:3671392
Created September 8, 2012 02:27
Use seq instead of empty?
(def pack [])
;try to avoid this
(if (not (empty? pack)) (print "something") (print "empty"))
;in favor of this
(if (seq pack) (print "something") (print "empty"))
leandromoreira /
Created October 22, 2012 16:45
Do something in all subdirectories Unix Shell Terminal Command
$ for dir in *; do echo $dir ; done;
leandromoreira / robot.js
Created December 5, 2012 22:52
var Robot = function(robot) {
var firstTime = true;
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
var moveAhead = Math.floor(Math.random()*101);
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Clappr plugin dev tutorial 1 - Hello World</title>
<script type="text/javascript" src=""></script>
<h1>Clappr plugin dev tutorial 1 - Hello World</h1>
.factory('theirTwitterFactory', function($http){
var factory = {};
.success(function(data, status, headers, config) {
factory.tweets = data;
return {
tweets: function(){