Skip to content

Instantly share code, notes, and snippets.

@leandromoreira
leandromoreira / bkp_purge.sh
Created February 6, 2014 02:03
It makes backup and purges it.
#!/bin/bash
set -e
NOW=$(date +"%m-%d-%Y-%H-%M")
SOURCE_FOLDER_BKP=$1
DEST_FOLDER_BKP=$2
## Compacting and making backup
tar -zcf $DEST_FOLDER_BKP/bkp.$NOW.tar.gz $FOLDER_TO_BKP
@leandromoreira
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 https://gist.github.com/jbochi
if len(sys.argv) != 2:
print "Usage: %s <filename>" % sys.argv[0]
sys.exit(1)
with open(sys.argv[1]) as f:
chars = f.read()
@leandromoreira
leandromoreira / speed_run_terms.py
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"

Instructions

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
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
leandromoreira / do_something_all_subdirectoreis.sh
Created October 22, 2012 16:45
Do something in all subdirectories Unix Shell Terminal Command
$ for dir in *; do echo $dir ; done;
@leandromoreira
leandromoreira / robot.js
Created December 5, 2012 22:52
dreampeppers99
var Robot = function(robot) {
};
var firstTime = true;
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
var moveAhead = Math.floor(Math.random()*101);
robot.ahead(moveAhead);
<!DOCTYPE html>
<html>
<head>
<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="http://cdn.clappr.io/latest/clappr.min.js"></script>
</head>
<body>
<h1>Clappr plugin dev tutorial 1 - Hello World</h1>
angular.module('twitter')
.factory('theirTwitterFactory', function($http){
var factory = {};
$http.get('/data/theirs.json')
.success(function(data, status, headers, config) {
factory.tweets = data;
});
return {
tweets: function(){