Skip to content

Instantly share code, notes, and snippets.

@rayansostenes
rayansostenes / tabela_para_CSV.js
Created November 28, 2011 14:43
Bookmarklet que exporta os dados de uma tabela em CSV
/**
* Bookmarklet que exporta os dados de uma tabela em CSV
*
* Para evitar poluir no namespace rodamos o script numa função anônima
*/
(function(){
//Verifica a existência do jQuery
if (typeof jQuery == 'undefined') {
var jQ = document.createElement('script');//Cria um novo elemento do tipo script
jQ.type = 'text/javascript';//Define o tipo desse elemento para text/javascript
#!/usr/bin/python
#--------------------------------------
# ___ ___ _ ____
# / _ \/ _ \(_) __/__ __ __
# / , _/ ___/ /\ \/ _ \/ // /
# /_/|_/_/ /_/___/ .__/\_, /
# /_/ /___/
#
# lcd_16x2.py
# 16x2 LCD Test Script
@rayansostenes
rayansostenes / haveInternet.py
Created July 19, 2015 03:33
A python method to check if the system have a active connection to the internet
import socket
def haveInternet():
REMOTE_SERVER = "www.google.com"
try:
host = socket.gethostbyname(REMOTE_SERVER)
s = socket.create_connection((host, 443))
return True
except:
@rayansostenes
rayansostenes / returnIP.py
Last active August 29, 2015 14:25
Retorna o IP de uma interface de rede
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import netifaces
def get_if_ipaddr(iface):
"""
Retorna o IP de uma interface de rede
Args:
#!/bin/bash
# Envia o resultado de um comando para um tailbox `dialog`
# Parametros:
# $1 - titulo
# $2 - comando
pipe_command_to_tailbox_dialog() {
# Extraindo os parametros,sempre usando $1 seguido de `shift`
local title="$1"; shift
#!/bin/bash
sudo apt-get install --no-install-recommends xserver-xorg xinit xserver-xorg-video-fbdev lxde lxde-common lightdm
sudo apt-get install git build-essential xorg-dev xutils-dev x11proto-dri2-dev libltdl-dev libtool automake libdrm-dev
git clone https://github.com/ssvb/xf86-video-fbturbo.git
cd xf86-video-fbturbo
autoreconf -vi
./configure --prefix=/usr
@rayansostenes
rayansostenes / bookmarlet.js
Last active March 21, 2017 00:02
Bookmarlet Nubank to CSV
javascript:window.open('data:text/plain;base64,'+btoa(angular.element(document.querySelector('.md-tab-content:not(.ng-hide) .charge')).scope().$parent.$parent.charges.map(c => `${c.post_date.split('-').reverse().join('/')};${c.title};${c.category};${(c.amount/100).toFixed(2).replace('.', ',')}`).join('\n')))
import requests
from collections import Counter, defaultdict
class TextSearch:
def __init__(self, url):
self.url = url
self.word_list = [str(v).lower() for v in self.get_text().split()]
self.word_lenght = len(self.word_list)
self.word_count = Counter(self.word_list)
self.count_word = defaultdict(list)
# rodrigo.deodoro@esharesinc.com
def validate_matrix(matrix):
# Valida linhas
if not all(list_int(i) for i in matrix):
return False
# Valida colunas
columns = []
(function (doc) {
function getForm() {
return doc.querySelector('#formQuestao');
}
function getQuestionId() {
const form = getForm();
return parseInt(form.querySelector('input[name="questao_id"]').value, 10);
}