Skip to content

Instantly share code, notes, and snippets.

View luizamboni's full-sized avatar
💭
I may be slow to respond.

Luiz Zamboni luizamboni

💭
I may be slow to respond.
View GitHub Profile
@luizamboni
luizamboni / gist:0569a644c3634e1b428d
Last active August 29, 2015 14:21
atribuição e soma de variáveis
;---------------------------------------------------
; Programa: attribuição e soma de variãveis
; Autor: Luiz Carlos Zamboni
; Data: 25/05/2015
;---------------------------------------------------
LDI 0 ; zerar o acumulador
X EQU 80 ; variavel 1 128 em decimal
Y EQU 81 ; variavel 2 129 em decimal
@luizamboni
luizamboni / sidekiq_start_with_jruby.sh
Created November 14, 2015 02:36
only run sidekiq with JRUBY in rvm when the raisl project still run in MRI
rvm use jruby && bundle && bundler exec sidekiq -e development -C config/sidekiq.yml
@luizamboni
luizamboni / StrongParameters.java
Last active March 2, 2016 15:00
StrongParameters in Java to filter parameters from view
package com.company;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class StrongParameters {
@luizamboni
luizamboni / Router.java
Created March 8, 2016 01:49
Eval Route class to Eval and contruct paths for Routes
import java.util.Arrays;
public class Routes {
public static void main(String[] args)
{
Route editRoute = new Route("admin/user/edit/:id").withMethod("GET").dispatch(ExampleController.class).withAction("edit");
System.out.println(editRoute);
System.out.println(editRoute.match("admin/user/edit/34"));
@luizamboni
luizamboni / latexToPng.cpp
Created April 9, 2016 22:15
latexToPng, source provided Licence GPL by Bruno Bachelet
//==================================================================================================
// T e x 2 p n g Implementation
// By Bruno Bachelet
//==================================================================================================
// Copyright (c) 1999-2011
// Bruno Bachelet - bruno@nawouak.net - http://www.nawouak.net
//
// This program is free software; you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
@luizamboni
luizamboni / parallel_process.js
Created April 28, 2016 20:49
like a Thread pool in nodejs
"use strict";
var P = require("bluebird")
var _ = require("underscore")
let items = [0,12.5,5,5,87,8,7,48,58,7,78,4,87,854,84,787,78,4,87,7]
console.log("items length ------------> " + items.length)
let level = 0
function processList(_items){
@luizamboni
luizamboni / userdata-elasticsearch.sh
Last active October 27, 2016 16:35
create a digitalocean droplet with elasticsearch enabled to listen private network
#!/bin/sh
export PRIVATEADDRS=$(curl -s http://169.254.169.254/metadata/v1/interfaces/private/0/ipv4/address)
apt-get update
sudo apt-get install default-jre -y
wget -O /tmp/es https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.4.1/elasticsearch-2.4.1.deb
@luizamboni
luizamboni / rackup.ru
Created October 28, 2016 17:06
api from rails app
# This file is used by Rack-based servers to start the application.
class Api
def initialize app
@app = app
end
def call(env)
req = Rack::Request.new env
@luizamboni
luizamboni / ead.cpp
Created November 2, 2016 00:48
aed trabalho
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
/*
para comilar no linux use:
g++ ead.cpp
e para rodar:
./a.out -a 1
@luizamboni
luizamboni / deploy-phoenix.sh
Created April 18, 2017 04:50
phoenix very simple deploy in digitalOcean
USER="root" # default digitalOcean user
APP_NAME="xxx"
DEPLOY_DIR="/var/www/${APP_NAME}/"
HOST="xxx.xxx.xxx.xxx"
echo -e "1) update project"
CMD="cd ${DEPLOY_DIR} && git pull"
echo $CMD
ssh ${USER}@${HOST} $CMD