Skip to content

Instantly share code, notes, and snippets.

Avatar
🚴‍♂️
💨 💨

Enzzo souenzzo

🚴‍♂️
💨 💨
View GitHub Profile
@souenzzo
souenzzo / flashtrick.sh
Created Jul 15, 2015
The simplest way to install/remove flash in userland
View flashtrick.sh
## 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
Read a serial and write on http
View server.go
package main
import (
// "fmt"
// "io"
"net/http"
"os"
)
func readSerial(w http.ResponseWriter, r *http.Request) {
@souenzzo
souenzzo / velha.c
Created May 14, 2016
Jogo da velha em C. Acho que nunca perde.
View velha.c
// 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 Jun 16, 2016
Exibe branch no prompt do bash, muda de cor quando há mudanças não commitadas.
View .bashrc
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 Jun 30, 2016
Resolução do desafio, sem usar variaveis.
View rev.c
#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 Jun 30, 2016
Desavio, com tail rec
View rev_rec.c
#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;
View test.py
#!/usr/bin/env python2
from jinja2 import Template
from yaml import load
JYAML="""
- name: Minimal
# comment
tasks:
- name: "Testando 1 2 3 {{ nome }}"
View chroot.yml
---
- name: Exemplo
connection: chroot
hosts: chroots
tasks:
- ping:
### cat ./hosts
#[chroots]
#/arch ansible_python_interpreter=/usr/bin/python2
View coletor.py
#!/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)
View repl.hy
~ 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
=>
You can’t perform that action at this time.