Skip to content

Instantly share code, notes, and snippets.

@flisboac
flisboac / download.js
Created August 21, 2013 22:37
Download file using JScript. Not tested (yet), because of work's proxy policies and Stupid Windows!
var fs = new ActiveXObject("Scripting.FileSystemObject");
var shell = new ActiveXObject("WScript.Shell");
var url = WScript.Arguments(0);
var to;
try {
to = WScript.Arguments(1);
} catch(err) {
to = null;
@flisboac
flisboac / UKL
Last active August 29, 2015 14:05
A keyboard layout I did after lots of frustration with the UK-based layouts on Windows 8.
This layout adds some easier shortcuts to insert common latin accented letters
on top of the standard AltGr shortcuts. Some deadkeys were added to an UK
International layout:
' as ´ (AltGr + /, modified to use ç and Ç instead of ć and Ć, AltGr combination intact)
~ as a deadkey (AltGr + ~)
` as a deadkey
^ as a deadkey (AltGr + ^)
" as a deadkey (AltGR + :)
@flisboac
flisboac / Tokenizer.java
Last active August 29, 2015 14:07
A pretty simple and rudimentar tokenizer, written in Java and using a rather non-intuitive java.util.Scanner management model (per token type).
package flisboac;
import java.io.IOException;
import java.util.Scanner;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.regex.Pattern;
@flisboac
flisboac / opencl-example-vecmul
Last active August 29, 2015 14:07
A simple, yet complex, yet complete, yet big, example of vector multiplication, implemented in both CPU and GPU (using OpenCL).
A simple, yet complex, yet complete, yet big, example of vector multiplication, implemented in both CPU and GPU (using OpenCL).
@flisboac
flisboac / Exemplo.bdd
Last active August 29, 2015 14:20
Exemplo TDD/BDD
Caso de uso: Usuário realiza cadastro de outros usuários
Descrição: ...
Cenário: Usuário entra na tela de cadastro para editar
Quando: Usuário digita e-mail *@localhost
Então: Falhar
Cenário: Fornecendo idade
Se idade for maior que 85
Então solicitar idade menor
@flisboac
flisboac / intsort.c
Last active September 8, 2015 15:20
Sorts and prints the integer set passed as program arguments.
Sorts and prints the integer set passed as program arguments.
@flisboac
flisboac / Vm.java
Last active November 28, 2015 23:22
Uma máquina virtual bem simples...
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
@flisboac
flisboac / SpecificationDesignTest.java
Last active January 14, 2016 17:16
Some design tests with DDD's Specification Pattern.
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Objects;
import java.util.Random;
#/usr/bin/env python
default_impl = object()
no_impl = object()
def _empty_impl():
pass
def _is_empty_impl(fn, pfn = None):
return _empty_impl.__code__.co_code == fn.__code__.co_code
#!/usr/bin/env python
from functools import total_ordering
@total_ordering
class avg(object):
@property
def empty(self):