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 imaplib | |
import re | |
import random | |
from email.parser import BytesHeaderParser | |
from typing import List | |
import tqdm | |
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 json | |
import spotipy | |
import spotipy.util | |
""" | |
Various constants -- the secrets should be moved to a .env file. SPOTIFY_SCOPES too broad, should be reduced. | |
""" |
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 matplotlib import pyplot as plt | |
from tqdm import tqdm | |
board = np.zeros((255, 255)) | |
board[127][127] = 1 | |
board[127][128] = 1 | |
board[128][127] = 1 | |
board[128][128] = 1 |
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 django.core.management.base import BaseCommand, CommandError | |
from django.contrib.auth.models import User | |
from django.conf import settings | |
import ldap | |
class Command(BaseCommand): | |
help = 'Add a specific user from LDAP' | |
def add_arguments(self, parser): | |
parser.add_argument('user_id', nargs='+', type=str) |
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 PIL import Image | |
import tqdm | |
import math | |
import vector | |
height = 320 | |
width = 240 | |
scene = {} |
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 glob | |
from collections import defaultdict | |
classes = defaultdict(lambda: defaultdict(list)) | |
class Klass: | |
def __init__(self, name, project): | |
self.name = name | |
self.project = project |
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 socket | |
from pyvmu import vmu931, messages | |
class VMUTransmit(object): | |
def __init__(self, ip, port, device="/dev/tty.usbmodem1411", euler=True, accelerometer=True, quaternion=True): | |
self.__device = device | |
self.__euler = euler | |
self.__accelerometer = accelerometer |
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
# frames is a list of mdarrays | |
new_image = np.zeros(frames[n].shape, dtype=frames[n].dtype) | |
for ny, y in tqdm(enumerate(flow)): | |
for nx, flow in enumerate(y): | |
x_flow, y_flow = flow | |
new_x = int(nx+x_flow*flow_scaling) | |
new_y = int(ny+y_flow*flow_scaling) |
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 slackclient import SlackClient | |
from datetime import datetime | |
import time | |
slack_token = 'xoxb-token-goes-here' | |
sc = SlackClient(slack_token) | |
if sc.rtm_connect(): | |
while True: | |
try: |
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 | |
import random | |
from queue import Queue | |
from multiprocessing import Process | |
import os | |
def produce_data(q): | |
print("[+] Producer thread started (PID: {})".format(os.getpid())) | |
while True: |