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
from collections import defaultdict | |
import csv | |
csv.field_size_limit(999999999) | |
def get_csv(filename): | |
# get data from csv | |
# don't use built ins, like input, as variable names | |
with open('filename', 'r') as file_handle: | |
reader = csv.reader(file_handle, delimiter='|') |
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 Message(): | |
'''mockup for discord message''' | |
def __init__(self, user, incoming): | |
self.user = user | |
self.incoming = incoming | |
def send_message(self, what): | |
print('{}: {}'.format(self.user, what)) |
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 requests | |
from bs4 import BeautifulSoup | |
import sqlite3 | |
import sys | |
import time | |
GROUPS = { | |
'Grenade':(52,55), | |
'Other':(55,56), |
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
from __future__ import print_function | |
# updated to work with py3 using only standard lib modules | |
# unsure if it will work with py2 still... | |
import plistlib | |
import struct | |
import sys | |
from binascii import hexlify |
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
from __future__ import print_function | |
from builtins import input | |
#!/bin/py | |
#Python 2.7.6 | |
"""A text-based Python 2.7.6 implementation of the game Rock-Paper-Scissors. | |
Game play: | |
* each round, both players select from: rock, paper, or scissors | |
* rock beats scissors, scissors beats paper, paper beats rock |
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(object): | |
"""The class the handles the Node objects""" | |
def __init__(self, data=None, prev=None, next=None): | |
self.data = data | |
self.prev = prev | |
self.next = next | |
def __str__(self): | |
return "Node[Data = %s]" % (self.data,) |
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 numpy as np | |
from itertools import product | |
from random import shuffle,random | |
def blank_road(**args): | |
lanes, cells = args['lanes'], args['cells'] | |
return np.zeros((lanes, cells)) |
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 | |
# initialize an events dictionary that will later be populated with different | |
# functions to be called as events are identified by poll | |
global EVENTS | |
def poll(state): |
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 | |
# create a dictionary | |
state = { | |
'start': time.time(), | |
'countdown': 5, | |
'clock': 5, | |
'ok': True, | |
'boosters': 'off', |
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 | |
""" | |
merge a config change and commit it. | |
Requires config.cfg with your config snippet inside at root directory. | |
""" | |
from napalm import get_network_driver | |
from jnpr.junos.exception import ConnectAuthError | |
from iptools import ipv4 | |
import os |
NewerOlder