This file contains 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
# This Python file uses the following encoding: utf-8 | |
from copy import deepcopy | |
from hashlib import sha256 | |
class Blockchain: | |
def __init__(self, difficulty = 1): | |
genesis_block = GenesisBlock() | |
self.chain_tail = genesis_block | |
self.geneis_block = genesis_block |
This file contains 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 Node(): | |
def __init__(self, value): | |
self.value = value | |
self.left = None | |
self.right = None | |
def append(self, value): | |
if value < self.value: |
This file contains 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 | |
"""" | |
Compare isinstance, type and ducktyping to see which one is quickest. | |
Typical output | |
============= | |
IsInstance 0.00567038607597 | |
ducktyping 0.0232819545269 | |
type 0.004327688694 |
This file contains 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 os, requests, time | |
from datetime import datetime | |
import socket | |
URL = "https://showmemyip.example.com" # EDIT THIS. NEEDS TO BE A URL THAT RETURNS YOUR PUBLIC IP. | |
CORRECT_REVERSE_URL = "ipredator.se" # EDIT THIS TO BE THE REVERSE-URL OF YOUR VPN PROVIDER | |
VPN_CONNECTION_NAME = "Ipredator" # EDIT THIS TO THE NAME OF THE VPN CONNECTION IN NETWORK-MANAGER. | |
""" | |
Run this script in cron to verify that you are connected to your desired VPN service | |
which is automatically reconnected if the connection is lost |
This file contains 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
all_questions = None | |
for database in databases: | |
if all_questions is None: | |
all_questions = load_questions(database=database,verified=True) | |
build_something(questions) |
This file contains 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 | |
""" | |
Python script to download all your dailyview.com images | |
Run with 'python download.py' | |
Depends on requests and Beautiful soup | |
""" |
This file contains 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 | |
""" | |
Python script to download all the Last Tuesday Society podcasts in one swoop | |
Find them here: http://www.thelasttuesdaysociety.org/podcasts.html | |
Run with 'python lasttuesdaysocietypodcast.py' | |
Depends on requests and Beautiful soup | |
""" |
This file contains 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
(1000603665) {"1000046259": 1.0, "1000045077": 1.0} | |
(1001390102) {"1000913520": 1.0, "1000042346": 1.0} | |
(1004797975) {"1000046435": 1.0, "1003829903": 1.0} | |
.... some 200k rows more ... | |
(1004536000)-[:SIMILAR]->(1000840000) | |
(1004536000)-[:SIMILAR]->(1005442000) |
This file contains 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 codecs | |
from collections import Counter | |
class Card: | |
def __init__(self, data): | |
self.idnr= data[0].strip("\n") | |
self.category = data[1].strip("\n") | |
self.star = data[2].strip("\n") | |
self.name = data[3].strip("\n") |
This file contains 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 codecs | |
from collections import Counter | |
class Card: | |
def __init__(self, data): | |
self.idnr= data[0].strip("\n") | |
self.category = data[1].strip("\n") | |
self.star = data[2].strip("\n") | |
self.name = data[3].strip("\n") |
NewerOlder