Skip to content

Instantly share code, notes, and snippets.

View tiagoengel's full-sized avatar

Tiago Henrique Engel tiagoengel

View GitHub Profile
package systextil.commons.io.path;
import java.io.File;
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.NativeMapped;
import com.sun.jna.PointerType;
import com.sun.jna.win32.W32APIOptions;
/**
* Regra de converção de moedas para o imposto de renda:
*
* Valor do dólar dos Estados Unidos da América, fixado pela autoridade monetária
* do país de origem dos rendimentos na data do recebimento.
*
* Em seguida convertido para reais pelo valor de compra do dólar fixado pelo Banco Central do Brasil
* para o último dia útil da 1a quinzena do mês anterior ao do recebimento dos rendimentos.
*/
defmodule Av4 do
def do_it() do
{:ok, buffer} = File.read("/Users/tiagoengel/Downloads/input-4.txt")
list = String.split(buffer, "\n")
|> Enum.drop(-1)
|> Enum.map(&transform_entry/1)
|> Enum.sort(&sort_entry/2)
result = traverse_events(list, nil, nil, %{})
/**
* Regra de converção de moedas para o imposto de renda:
*
* Valor do dólar dos Estados Unidos da América, fixado pela autoridade monetária
* do país de origem dos rendimentos na data do recebimento.
*
* Em seguida convertido para reais pelo valor de compra do dólar fixado pelo Banco Central do Brasil
* para o último dia útil da 1a quinzena do mês anterior ao do recebimento dos rendimentos.
*/
@tiagoengel
tiagoengel / promises.js
Last active September 10, 2017 20:50
small helper to facilitate tests with async code
/**
* Small helper that keeps all running promises on a
* queue and allows a test to wait for all async code
* to finish before doing any assertions
*/
const NativePromise = window.Promise
let queue = []
class TestPromise extends NativePromise {
#!/bin/sh
echo "MAKE SURE TO START bin/mojo before you run this script!"
JS_SPECS=$(git diff-tree --no-commit-id --name-only -r HEAD | grep '\.test\.js')
RUBY_SPECS=$(git diff-tree --no-commit-id --name-only -r HEAD | grep '_spec.rb' | sed -e ':a;N;$!ba;s/\n/ /g')
if [ "$RUBY_SPECS" != "" ]; then
bin/rspec $RUBY_SPECS
fi
toggle(e) {
e.preventDefault();
let wrapperHeight = this.refs.transitionWrapper.clientHeight;
if (this.state.expanded) {
this.setState({ expanded: false, submenuHeight: 0 }));
} else {
this.setState({
expanded: true,
submenuHeight: wrapperHeight
});
@tiagoengel
tiagoengel / noise-cancellation.sh
Last active May 12, 2023 20:41
Hiss / White / Static noise cancellation on Linux using Pulseaudio and Sox
#!/bin/bash
# You'll need to have sox, pavucontrol and alsa-utils installed, and the snd_aloop kernel module loaded.
# You can configure your system to load it on startup or load it manually with "sudo modprobe snd_aloop"
# Once this is script is running, you need to start recording audio in the application of your
# preference, open pavucontrol, go to the recording tab and change the recording source of that application
# to "Monitor of Loopback ..."
time=5