Skip to content

Instantly share code, notes, and snippets.

View andersonfraga's full-sized avatar
🧩
Focusing

Anderson Fraga andersonfraga

🧩
Focusing
View GitHub Profile
@rponte
rponte / using-uuid-as-pk.md
Last active May 6, 2024 21:23
Não use UUID como PK nas tabelas do seu banco de dados

Pretende usar UUID como PK em vez de Int/BigInt no seu banco de dados? Pense novamente...

TL;TD

Não use UUID como PK nas tabelas do seu banco de dados.

Um pouco mais de detalhes

@contraexemplo
contraexemplo / pulseaudio-noise-cancelling.md
Last active October 20, 2023 18:15
Como ativar o módulo de cancelamento de ruído do PulseAudio

Primeiro, verifique se o módulo está presente na sua instalação digitando pacmd em seu terminal, listando todos os módulos presentes pelo comando list-modules e procurando por module-echo-cancel. Não está presente? Você precisa adicionar algumas linhas ao arquivo de texto responsável pela configuração do PulseAudio.

Com o seu editor favorito, abra (com privilégios de administrador) o arquivo /etc/pulse/default.pa e adicione as seguintes linhas ao fim do arquivo:

### Enable Echo/Noise-Cancellation
load-module module-echo-cancel use_master_format=1 aec_method=webrtc aec_args="analog_gain_control=0\ digital_gain_control=1" source_name=echoCancel_source sink_name=echoCancel_sink
set-default-source echoCancel_source
set-default-sink echoCancel_sink
@hikari-no-yume
hikari-no-yume / example.php
Created March 20, 2017 20:02
function chaining for PHP 7
<?php declare(strict_types=1);
require_once "✨.🐘";
✨($_)->strlen("foo")->var_dump($_);
@jsvd
jsvd / README.md
Last active July 28, 2022 03:45
logstash grok filter benchmark script

Requirements:

  • JDK 8/9/11 (oracle or openjdk)

Steps to setup the scripts:

mkdir benches
cd benches
curl https://artifacts.elastic.co/downloads/logstash/logstash-7.6.0.tar.gz | tar -zxf - 
cd logstash-7.6.0
@bearfrieze
bearfrieze / comprehensions.md
Last active December 23, 2023 22:49
Comprehensions in Python the Jedi way

Comprehensions in Python the Jedi way

by Bjørn Friese

Beautiful is better than ugly. Explicit is better than implicit.

-- The Zen of Python

I frequently deal with collections of things in the programs I write. Collections of droids, jedis, planets, lightsabers, starfighters, etc. When programming in Python, these collections of things are usually represented as lists, sets and dictionaries. Oftentimes, what I want to do with collections is to transform them in various ways. Comprehensions is a powerful syntax for doing just that. I use them extensively, and it's one of the things that keep me coming back to Python. Let me show you a few examples of the incredible usefulness of comprehensions.

@jvrmaia
jvrmaia / fastfib.py
Created March 26, 2015 13:02
q-matrix <3
import cProfile
def fibonacci(n):
if n < 0:
raise ValueError("Negative arguments not implemented")
print _fib(n)[0]
def _fib(n):
@tronsha
tronsha / installphp7.sh
Last active October 13, 2023 00:13
Install PHP7 to Ubuntu
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
apt-get update
apt-get install -y git-core autoconf bison libxml2-dev libbz2-dev libmcrypt-dev libcurl4-openssl-dev libltdl-dev libpng-dev libpspell-dev libreadline-dev make
mkdir -p /etc/php7/conf.d
mkdir -p /etc/php7/cli/conf.d
mkdir /usr/local/php7
@peczenyj
peczenyj / hosts
Created January 28, 2015 13:12
como resolver o maldito paywall da folha
# adicione essa linha no seu /etc/hosts
127.0.0.1 paywall.folha.uol.com.br
@peczenyj
peczenyj / coligacoes.pl
Last active April 19, 2016 10:49
script para verificar quantidade de coligações entre partidos nas eleições para presidente + estaduais
#!/bin/perl
use strict;
use warnings;
use JSON qw(decode_json);
use Text::Table;
use LWP::Simple;
my $URL = "http://estaticog1.globo.com/2014/07/Coligacoes/eleicao.json";
@alganet
alganet / 00-index.sh
Last active September 28, 2019 21:25
POSIX Shell HTTP/CGI application. Run as ./00-index.sh in ksh, dash, bash or zsh
# Main file, loads dependencies and holds application code
# Usage:
# $ git clone https://gist.github.com/a22a1373dcee7c175d1e.git
# $ cd a22a1373dcee7c175d1e
# $ chmod +x 00-index.sh
# $ ./00-index.sh
#
# Use sudo if your machine denies an address to netcat
#