Skip to content

Instantly share code, notes, and snippets.

View kanazux's full-sized avatar
🏠
Working from home

Silvio Giunge a.k.a kanazuchi kanazux

🏠
Working from home
View GitHub Profile
@kanazux
kanazux / sng_mysql.py
Created July 19, 2013 17:14
Read data from pipe and send to mysql db
#!/usr/local/bin/python -u
import sys
import subprocess
conn = 'mysql -p123 -b webfilter'
ins_mysql = '-e "insert into ntable (url_str, elapsed_ms, size_bytes, ip, username) values (\'%s\', %s, %s, \'%s\', \'%s\')'
while 1:
fd=sys.stdin.readline()
@kanazux
kanazux / returnip.py
Created December 26, 2013 12:45
Return my ip by speedtest xml
#!/usr/bin/env python
# -*- coding: ISO-8859-1 -*-
# Created in: Thu 19/Dec/2013 hs 15:06
# Last Change: Thu 19/Dec/2013 hs 15:06
# Autor: -- kanazuchi --
from urllib2 import urlopen
from xml.dom import minidom as dom
url = dom.parseString(urlopen('http://www.speedtest.net/speedtest-config.php').read())
@kanazux
kanazux / parse_csv.py
Last active August 29, 2015 13:56
An parse to content in txt file to csv file
#!/usr/local/bin python
# -*- coding: iso-8859-1 -*-
# autor: Silvio Giunge (kanazuchi)
# export content in txt file to csv file
import re
import os
import sys
from string import digits
from subprocess import check_output
@kanazux
kanazux / consumer.c
Last active August 29, 2015 13:56
consumer em c
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <curl/curl.h>
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
#define MAX_STRING_LEN 6000002
#define NUMT 4
@kanazux
kanazux / newconsumer.c
Created February 17, 2014 19:35
newconsumer.c
#include <stdio.h>
#include <stdlib.h>
#include <curl/curl.h>
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
#define MAX_STRING_LEN 6000002
size_t read_data (char *bufptr, size_t size, size_t nitems, void *userp)
def findserie(serie,season,srange,frange):
import os
nserie = serie.replace(" ","_")
os.system("firefox -P default &")
for x in range(srange,frange):
os.system("firefox -p default --new-tab http://thepiratebay.se/search/%s\ s%se%s\/0\/7\/0" % (nserie,"{:02d}".format(season),"{:02d}".format(x)))
@kanazux
kanazux / getchar_to_op.c
Last active August 29, 2015 13:57
escolha a operação através de uma letra
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
char letra;
float numb1, numb2, result;
printf("Digite o primeiro numero da operacao:");
@kanazux
kanazux / search_pkts.py
Last active August 29, 2015 13:57
Get packets from url with list of packets for freebsd or another unix distro
#!/usr/local/bin/env python
#
# written by kanazuchi
#
import re
import sys
from urllib2 import urlopen
def search_pkts(url, pkt):
@kanazux
kanazux / def_defaultdict.py
Created April 2, 2014 12:37
Default dict on python collections module
from collections import defaultdict
dicionario = defaultdict(list)
fox1982 = {"ano" : "2008", "cor" : "branco", "revisao" : "ok"}
fox8219 = {"ano" : "2009", "cor" : "branco", "revisao" : "not ok"}
dicionario['carros'].append(fox1982)
dicionario['carros'].append(fox8219)
@kanazux
kanazux / wflogs.py
Last active October 23, 2015 16:38
print logs for webfitler, teste signals control c
#!/usr/local/bin/python
#
# Written by kanazuchi
#
import os
import re
import sys
import time
import signal