Skip to content

Instantly share code, notes, and snippets.

@marioluan
marioluan / github-pr-closed-webhook-data-example.json
Created April 2, 2024 07:38
github-pr-closed-webhook-data-example
{
"accept": "*/*",
"host": "smee.io",
"user-agent": "GitHub-Hookshot/9b97f8a",
"max-forwards": "10",
"x-github-delivery": "96a80720-f0c2-11ee-9b0a-b980f6ca0037",
"x-github-event": "pull_request",
"x-github-hook-id": "470162148",
"x-github-hook-installation-target-id": "111815790",
"x-github-hook-installation-target-type": "organization",
{
"Ansi 6 Color" : {
"Green Component" : 0.73333334922790527,
"Blue Component" : 0.73333334922790527,
"Red Component" : 0
},
"Tags" : [
],
"Ansi 12 Color" : {
@marioluan
marioluan / sample.sh
Created March 17, 2017 13:17
Sample bash.
#!/bin/bash
execute(){
echo "sample execute like a charm!"
}
@marioluan
marioluan / .git.aliases
Created February 24, 2017 17:32
Git related gists.
alias glog="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
@marioluan
marioluan / export-linkedin-profile-as-pdf.js
Last active June 23, 2023 13:05
Export your linkedin public profile to PDF if you're having trouble with internationalization.
// Reason to create this script:
// My profile was created in portuguese, but when I translated
// it to english and tried to save my profile as PDF, it could not
// translate some words and dates to english, so I created this gist
// as an alternative.
// Usage
// 1. open your public profile in an incognito* browser tab. E.g.: https://www.linkedin.com/in/marioluan
// 2. copy-n-past the code below into the browser console
// 3. save as PDF
@marioluan
marioluan / sed-find-replace-current-directory.sh
Last active August 12, 2016 20:49
Shell script which finds and replaces all occurrences of given characters in files from the current directory.
#!/bin/bash
current_name=$1
new_name=$2
files=`grep -irl $current_name`
num_files=`grep -irl $current_name | wc -l`
echo "found $num_files file(s) with import name $current_name"
@marioluan
marioluan / ciphers.js
Created May 6, 2014 00:21
Collection of functions I wrote while taking the cryptography classes from Khan Academy.
var alphabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
function encryption ( word, shift ) {
var encryptedWord = '';
for (var i = 0; i < word.length; i++) {
var letter = word[i].toUpperCase();
var letterIndex = alphabet.indexOf(letter);
var shiftedIndex = letterIndex+shift;
var newLetterIndex = shiftedIndex % alphabet.length;
*linear:
- somente 1 dimensao
- lista finita e sequencial de items
A escolha do metodo a ser utilizado depende de:
- quantidade de dados envolvidos
- volume de operacoes de inclusao/exclusao
Algoritmos relacionados à memória primária
Busca linear/sequencial
@marioluan
marioluan / como-executar.txt
Last active April 18, 2019 00:53
Implementação de um servidor socket local em linux.
Compile os arquivos:
$ gcc -o executavel_server socket_server.c
$ gcc -o executavel_client socket_client.c
Inicie o server:
$ ./executavel_server
Rode o client:
$ ./executavel_client
@marioluan
marioluan / slider.js
Last active December 26, 2015 03:19
Classe JS para trabalhar com slider.
function Slider( containerSlider ){
this.container = document.querySelector( containerSlider );
this.botoesSlider = this.container.querySelectorAll( '.slider-navegacao-botao' );
this.tagImagem = this.container.querySelector( '.slider-imagem' );
this.listaImagens = this.tagImagem.attributes['data-images'].value.split(',');
this.areaClicavelImagem = this.container.querySelector( '.area-clicavel-imagem' );
this.botaoRetroceder = this.areaClicavelImagem.querySelector( '.botao-retroceder' );
this.botaoAvancar = this.areaClicavelImagem.querySelector( '.botao-avancar' );
this.posicaoSlider = 0;
this.quantidade = this.listaImagens.length;