Skip to content

Instantly share code, notes, and snippets.


Mario Luan marioluan

View GitHub Profile
View iterm.profile.json
"Ansi 6 Color" : {
"Green Component" : 0.73333334922790527,
"Blue Component" : 0.73333334922790527,
"Red Component" : 0
"Tags" : [
"Ansi 12 Color" : {
echo "sample execute like a charm!"
marioluan / .git.aliases
Created Feb 24, 2017
Git related gists.
View .git.aliases
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 / export-linkedin-profile-as-pdf.js
Last active May 5, 2021
Export your linkedin public profile to PDF if you're having trouble with internationalization.
View export-linkedin-profile-as-pdf.js
// 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.:
// 2. copy-n-past the code below into the browser console
// 3. save as PDF
marioluan /
Last active Aug 12, 2016
Shell script which finds and replaces all occurrences of given characters in files from the current directory.
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 / ciphers.js
Created May 6, 2014
Collection of functions I wrote while taking the cryptography classes from Khan Academy.
View ciphers.js
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;
View binary-search.js
- 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 / como-executar.txt
Last active Apr 18, 2019
Implementação de um servidor socket local em linux.
View como-executar.txt
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 / slider.js
Last active Dec 26, 2015
Classe JS para trabalhar com slider.
View slider.js
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;
marioluan / remover-acentos.js
Created Oct 10, 2013
Funcao marota para remover acentos de strings. Foi utilizado expressao regular em cima de caracteres representados na base hexadecimal.
View remover-acentos.js
* Remove acentos de caracteres
* @param {String} stringComAcento [string que contem os acentos]
* @return {String} [string sem acentos]
function removerAcentos( newStringComAcento ) {
var string = newStringComAcento;
var mapaAcentosHex = {
a : /[\xE0-\xE6]/g,
e : /[\xE8-\xEB]/g,