Skip to content

Instantly share code, notes, and snippets.

@magnunleno
magnunleno / demo.py
Created April 24, 2021 19:50
Flask CORS + NGROK demo
#!/usr/bin/env python
import logging
from flask import Flask, jsonify
from flask_cors import CORS
from flask_ngrok import run_with_ngrok
app = Flask(__name__)
logging.basicConfig(level=logging.INFO)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import aiohttp
import hashlib
import asyncio
from lxml import etree
from pprint import pprint
@magnunleno
magnunleno / .tmux.conf
Created December 23, 2016 00:46
Tmux mouse conf for versions prior and after to 2.1
if-shell '[ $(echo "$(tmux -V | cut -d" " -f2) <= 2.0" | bc) -eq 1 ]' \
"set -g mouse-select-window on; set -g mouse-select-pane on; set -g mouse-resize-pane on"
if-shell '[ $(echo "$(tmux -V | cut -d" " -f2) >= 2.1" | bc) -eq 1 ]' \
"set -g mouse on;"
@magnunleno
magnunleno / propostas_pybr12.py
Last active July 20, 2016 22:38 — forked from marciomazza/propostas_pybr12.py
Scrapping das propostas no site da pybr 12
#!/usr/bin/env python
import re
from bs4 import BeautifulSoup
from requests import get
from collections import defaultdict
assuntos_re = re.compile(r"\[(.*)\]")
res = get('http://speakerfight.com/events/python-brasil12-apresentacoes/')
soup = BeautifulSoup(res.content, 'html.parser')
@magnunleno
magnunleno / clean_pdf_gjuniioor.sh
Created January 17, 2016 04:18
Limpa PDFs do repositório gjuniioor/gjuniioor.github.io.git
git clone git@github.com:gjuniioor/gjuniioor.github.io.git
cd gjuniioor.github.io
du -sh .git
git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch archives/zines/magazine/h2hc/*.pdf' -- --all
git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch archives/zines/magazine/h2hc/*.pdf' -- --all
git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch pages/zines/magazine/h2hc/*.pdf' -- --all
git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch pages/zines/magazine/h2hc/*.pdf' -- --all
git gc --aggressive --prune=now
git prune --expire=now
git reflog expire --expire-unreachable=now --rewrite --all
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
char* int_to_bin_str(unsigned int n) {
int i;
int mask = 1;
char *str_n = (char*)malloc(32);
for (i = 0; i < 32; i++) {
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
from BeautifulSoup import BeautifulSoup
def sft_api():
primeiro_processo = 1473119
base_url = 'http://www.stf.jus.br/portal/processo/verProcessoAndamento.asp?incidente=%s' % primeiro_processo
@magnunleno
magnunleno / brogrammer-plus.vim
Created August 5, 2015 00:56
Brogrammer+ VIM Colorscheme
runtime colors/brogrammer.vim
let g:colors_name = "brogrammer+"
" Fix NonText (tab, CR and etc)
hi NonText ctermfg=22 ctermbg=234 cterm=NONE guifg=#30312a guibg=#1a1a1a gui=NONE
" Makes the Line Number color closer to the default BG
hi LineNr term=underline ctermfg=244 ctermbg=236 guifg=#838586 guibg=#232323
" Makes the current line number highlight changes only the FG
@magnunleno
magnunleno / python.vim
Created August 4, 2015 18:07
VIM's Python syntax customizations
" Match (only 'bar') in function calls like: 'foo.bar()' or 'bar()'
syn match pythonFunction /\(^\s*\(def\|class\)\s*\w*\)\@<!\w\{1,}\ze(/
" Match dunder methods/attributes
syn match pythonBuiltin "__\w*__"
" Match under methods/attributes
syn match pythonIdentifier "_\w*_"
" Match self (not in function declarations)
syn match pythonFunction /\(^\s*def \s*\w*\s*(\)\@<!self/
" Match self in function declarations
syn match pythonIgnore /\(^\s*def \s*\w*\s*(\)\@<=self\ze\s*[,)]/