Skip to content

Instantly share code, notes, and snippets.

View Visgean's full-sized avatar

martin Visgean

View GitHub Profile
@Visgean
Visgean / parse_dump.py
Created October 14, 2011 07:32
Parsing kismet dumps
import re # import python regexp library
with open("dumpfile.txt", "r") as file: # open the file
lines = file.readlines() # read lines from file
# at first I thought you want to parse even more parameters
# regular expression
pattern = "(?P<date>.*) IP (?P<senderIP>[\.\d]*)\.(?P<senderPort>\d*) \> (?P<reciverIP>[\.\d]*)\.(?P<recieverPort>\d*): Flags \[(?P<flags>.*)\],.*"
@Visgean
Visgean / fieldme.py
Created November 21, 2011 02:13
including fields from one form to another form
class someForm(ModelForm):
class Meta:
model = someModel
class AnotherForm(forms.Form):
def __init__(self, *args, **kwargs):
super(AnotherForm, self).__init__(*args, **kwargs)
for name, field in someForm().fields.iteritems():
@Visgean
Visgean / Let me be the best please.py
Created June 19, 2012 20:36
This scripts automatically votes at denik.cz
#! /usr/bin/python3
# -*- coding: UTF-8 -*-
# @author: Visgean Skeloru
# email: <visgean@gmail.com>
# jabber: <visgean@jabber.org>
# github: http://github.com/Visgean
from http import cookiejar
@Visgean
Visgean / backup.py
Created July 16, 2012 22:27
Backup all messages on facebook
#! /usr/bin/python
# -*- coding: UTF-8 -*-
import facebook
import urllib2
import codecs
print "You need API token: get one here: https://developers.facebook.com/tools/explorer"
USER_ACCESS_TOKEN= raw_input("Your API key: ")
>>> import pickle
>>> with open("backup.pkcl", "r") as ffile:
... threads = pickle.load(ffile)
...
>>> [thread["thread_id"] for thread in threads if thread["thread_id"]=="XC6AsBE4icQR1NGf6ZCVhw"]
@Visgean
Visgean / robot.js
Created December 20, 2012 00:38
Visgean
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
@Visgean
Visgean / robot.js
Created December 20, 2012 00:41
Visgean
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
[
{
'speaker': '1st Prop',
'speaker_full': '1st Proposition speaker',
'speech_length': 8*60,
'events' :[
{
'name':'Points forbidden', // this will be used as subtitle
'start_time': 0, // when this event happens before end?
'duration': 60, // how long is it going to last?
class SpotifyAPI():
def __init__(self, login_callback_func=False):
self.auth_server = "play.spotify.com"
self.logged_in_marker = Event()
self.heartbeat_marker = Event()
self.username = None
self.password = None
self.account_type = None
self.country = None
def authenticate
if request.post?
if params[:password] == 'sbk6JQ5wKCHr'
session[:authenticated] = true
respond_to do |format|
format.json { head :ok }
end
else
respond_to do |format|