Skip to content

Instantly share code, notes, and snippets.

View iskigow's full-sized avatar
🏠
Working from home

Rodrigo Catto iskigow

🏠
Working from home
  • TecSinapse
  • Campo Grande - MS, Brasil
View GitHub Profile
#!/bin/bash
unload() {
sudo killall VBoxNetDHCP
sudo /Library/Application\ Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh stop
}
load() {
sudo /Library/Application\ Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh start
}
@iskigow
iskigow / exemplo.txt
Last active December 24, 2015 21:59
Seletiva Facebook Hackaton 2013: Dados dois inteiros positivos n e k, gerar todos os binários entre os inteiros 0 e (2^n)-1, inclusive. Estes binários serão ordenados em ordem descrescente segundo a quantidade de 1s existentes no numero binário. Caso haja empate deve escolher o menor valor númerico. Retorne o k-ésimo elemento da lista ordenada.
Ex.: n = 3 e k = 5
['0b111', '0b11', '0b101', '0b110', '0b1', '0b10', '0b100', '0b0']
quinto elemento '0b1'
n = 4
['0b1111', '0b111', '0b1011', '0b1101', '0b1110', '0b11', '0b101', '0b110', '0b1001', '0b1010', '0b1100', '0b1', '0b10', '0b100', '0b1000', '0b0']
n = 5
['0b11111', '0b1111', '0b10111', '0b11011', '0b11101', '0b11110', '0b111', '0b1011', '0b1101', '0b1110', '0b10011', '0b10101', '0b10110', '0b11001', '0b11010', '0b11100', '0b11', '0b101', '0b110', '0b1001', '0b1010', '0b1100', '0b10001', '0b10010', '0b10100', '0b11000', '0b1', '0b10', '0b100', '0b1000', '0b10000', '0b0']
@iskigow
iskigow / script.hsrc
Created February 1, 2013 02:11
A HTTP Live header script for renew IP of Thomson DWG850-B4.
[[[HSRC]]]
[[[STEP]]]
[[[DEFINE routername="Thomson DWG850-B4"/]]]
[[[/STEP]]]
[[[STEP]]]
[[[REQUEST]]]
GET /RgDhcp.asp HTTP/1.1
Host: %%%routerip%%%
@iskigow
iskigow / LazyProdutoDataModel.java
Created November 8, 2012 00:12
Mostra um modo (usando LazyDataModel) de tratar o problema com a paginação uma listagem com filtros, quando a página selecionada é maior que a quantidade de páginas necessárias para exibir o resultado da listagem (filtrada).
public class LazyProdutoDataModel extends LazyDataModel<Produto> {
// ...
private ProtudoService produtoService;
// ...
@Override
public List<Produto> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, String> filters) {
@iskigow
iskigow / Anagram.groovy
Created December 21, 2011 03:35
TecSinapse DOJO -> One solution for the anagram's problem, using Groovy.
package br.com.tecsinapse.dojo
class Anagram {
def static anagram ( word ) {
// If the word has the size 1 it is itself the anagram, otherwise I want the permutations
return (word?.size() == 1) ? [ word ] : permutation( word )
}
def static permutation ( word ) {