Skip to content

Instantly share code, notes, and snippets.

View souenzzo's full-sized avatar
🚴‍♂️
💨 💨

Enzzo souenzzo

🚴‍♂️
💨 💨
View GitHub Profile
@souenzzo
souenzzo / flashtrick.sh
Created July 15, 2015 14:46
The simplest way to install/remove flash in userland
## To install
mkdir -p ~/.mozilla/plugins/ && curl -s "http://fpdownload.macromedia.com/get/flashplayer/pdc/$(curl -s 'https://helpx.adobe.com/flash-player/kb/archived-flash-player-versions.html' | grep -o '11\.2\(\.[0-9]\{3\}\)\{2\}' | sort | tail -1)/install_flash_player_11_linux.x86_64.tar.gz" | tar -x -z -C "$HOME/.mozilla/plugins/" "libflashplayer.so"
## To remove
rm ~/.mozilla/plugins/libflashplayer.so
@souenzzo
souenzzo / server.go
Created May 10, 2016 02:23
Read a serial and write on http
package main
import (
// "fmt"
// "io"
"net/http"
"os"
)
func readSerial(w http.ResponseWriter, r *http.Request) {
@souenzzo
souenzzo / velha.c
Created May 14, 2016 16:30
Jogo da velha em C. Acho que nunca perde.
// Compilar com 'gcc -o velha.x velha.c'
#include <stdio.h> //printf, scanf
#include <stdlib.h> //rand()
#define printt(t) for (int i=0;i<9;i++)printf("%c%c",t[i]?t[i]:' ',(i%3==2)?'\n':' ')
#define eh_valida(t,j) ( (j<9&j>=0)?t[j]?0:1:0 )
#define check_lin(t,c,n,i) ( t[i]+t[i+3]+t[i+6]==n*c )
#define empty_lin(t,i) ( t[i]?t[i+3]?i+6:i+3:i )
#define check_col(t,c,n,i) ( t[(3*i)]+t[(3*i)+1]+t[(3*i)+2]==n*c )
#define empty_col(t,i) ( t[3*i]?t[(3*i)+1]?(3*i)+2:(3*i)+1:3*i )
@souenzzo
souenzzo / .bashrc
Created June 16, 2016 20:52
Exibe branch no prompt do bash, muda de cor quando há mudanças não commitadas.
git_branch() {
GIT_STATUS="$(git status --porcelain 2> /dev/null)"
(( $? == 0 )) || return
if [[ -z "$GIT_STATUS" ]]; then
tput setaf 6
else
tput setaf 5
fi
@souenzzo
souenzzo / rev.c
Created June 30, 2016 16:06
Resolução do desafio, sem usar variaveis.
#include <stdio.h>
// Pega o ultimo elemento
int tail(int num, int base) {
return num % base;
}
// Pega o corpo, menos o ultimo elemento
int init(int num, int base) {
return num / base;
@souenzzo
souenzzo / rev_rec.c
Created June 30, 2016 19:09
Desavio, com tail rec
#include <stdio.h>
// base ^ power
int fpow(int base, int power) {
return (power == 1) ? 1 : base * fpow(base, power - 1);
}
// Ultimo digito do numero
int last(int num, int base) {
return num % base;
#!/usr/bin/env python2
from jinja2 import Template
from yaml import load
JYAML="""
- name: Minimal
# comment
tasks:
- name: "Testando 1 2 3 {{ nome }}"
---
- name: Exemplo
connection: chroot
hosts: chroots
tasks:
- ping:
### cat ./hosts
#[chroots]
#/arch ansible_python_interpreter=/usr/bin/python2
@souenzzo
souenzzo / coletor.py
Last active September 11, 2016 00:34
#!/usr/bin/env python3
from http import client
from bs4 import BeautifulSoup
def getElems(tr):
res = []
for th in tr:
if th.string != "\n":
res.append(th.string)
@souenzzo
souenzzo / repl.hy
Created October 18, 2016 02:10
hy problem
~ hy ## From pip
hy 0.11.1 using CPython(default) 3.5.2 on Linux
=> (let [x 3] (print x))
File "<input>", line 1, column 9
(let [x 3] (print x))
^^
HyMacroExpansionError: let lexical context element must be a list or symbol
=>