This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # encoding: utf-8 | |
| import numpy as np | |
| import sys | |
| def parse(path): | |
| f = open(path, 'r') | |
| lines = f.readlines() | |
| #init empty |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # encoding: utf-8 | |
| import networkx as nx | |
| import sys, random | |
| def parse(file): | |
| f = open(file, 'r') | |
| G = nx.DiGraph() | |
| first = True | |
| for row in f: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # encoding: utf-8 | |
| import networkx as nx | |
| from time import time | |
| import random | |
| """ | |
| Lab 1 EDAN55 | |
| Max cut: State-flipping algorithm | |
| https://github.com/thorehusfeldt/Maxcut-Lab | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ To run first | |
| touch old_url.txt | |
| touch data.txt | |
| requires requests and feedparser (available through pip) | |
| """ | |
| import requests | |
| import feedparser | |
| rss = 'http://www.dn.se/nyheter/m/rss/senaste-nytt' | |
| old_urls_file = 'old_url.txt' | |
| data_file = 'data.txt' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class LinkedList(startNode:Node) { | |
| var lastNode = startNode | |
| def printList() = { | |
| startNode.print() | |
| } | |
| def addNode(node:Node) = { | |
| this.lastNode.next = Some(node) | |
| node.last = Some(lastNode) | |
| this.lastNode = node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Before use: | |
| # * Put line seperated wordlist in file 'wordlist' | |
| # * Change device /dev/sdX to the drive/file you want to brute force | |
| # Call with 'sudo tc-brute.sh < wordlist'. | |
| while read line | |
| do | |
| if truecrypt -t -k "" --protect-hidden=no --non-interactive /dev/sdX -p $line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from random import randint | |
| class Game: | |
| def __init__(self): | |
| self.correct = randint(0,2) | |
| def make_guess(self, door): | |
| self.guess = door | |
| def verify(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import serial | |
| import time | |
| import sys | |
| from os import system | |
| class JoystickReader(): | |
| def __init__(self): | |
| try : |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ A small script to crawl a website with some songs on it and put it in a JSON file format.""" | |
| import requests, re, json | |
| re.DEBUG = True | |
| URL = "http://www.hedin.mobi/sangbok/lista.php" | |
| if __name__ == "__main__": | |
| r = requests.get(URL) | |
| reg = re.compile(r"<h2>(.+?)</h2><p>Melodi:(.*?)</p><p>(.+?)</p>") | |
| songs = reg.findall(r.content.replace("\r\n", '').decode('iso8859-1')) | |
| song_list = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import time,sys | |
| from random import randint | |
| class node(): | |
| def __init__(self, child1, child2, data): | |
| self.left = child1 | |
| self.right = child2 | |
| self.data = data | |
| def __str__(self): | |
| return str(self.data) |