Skip to content

Instantly share code, notes, and snippets.

View yabberyabber's full-sized avatar
🐐

Andrew Nelson yabberyabber

🐐
  • Arista Networks
  • San Luis Obispo, California
  • 21:30 (UTC -07:00)
View GitHub Profile
@yabberyabber
yabberyabber / gist:f274cac126206267675908ad5cf2430b
Last active December 21, 2020 19:05
Given the rss feed for a podcast, download it in its entirety.
#!/usr/bin/python3
import os
import sys
import pathlib
import shutil
import tempfile
import urllib.request
import concurrent.futures
class Person( object ):
def __init__( self, name, parent ):
self.name = name
self.children = []
self.parent = parent
if parent:
parent.children.append( self )
banana = Person( "Banana" )
cherry = Person( "Cherry", parent=banana )
@yabberyabber
yabberyabber / wrapping_exceptions.py
Created April 24, 2019 16:59
Python anti-patterns
try:
do_something()
except IndexError:
raise SomeOtherException()
void ObservableDualActionJoystick::TaskPrePeriodic(RobotMode mode) {
uint32_t currBtn = GetAllButtons();
if (m_observer != nullptr) {
int mask = 1, buttonId = 0;
for ( int buttonId = 0; buttonId < 64; buttonId++ ) {
if (m_prevBtn & mask != currBtn & mask) {
m_observer->ObserveDualActionJoystickStateChange(m_port, buttonId, currBtn & mask);
}
mask <<= 1;
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as npfig = plt.figure()
ax = fig.add_subplot(111, projection='3d')anchors
a = [0,57.735,30]
b = [50,-28.868,30]
c = [-50,-28.868,30]O = [0,0,0]X = np.arange(c[0],b[0],1)
Y = np.arange(b[1],a[1],1)def calc_T(a,b,c,o):
A = np.array([[(a[0]-o[0])/m.sqrt((a[0]-o[0])**2+(a[1]-o[1])**2+(a[2]-o[2])**2),(b[0]-o[0])/m.sqrt((b[0]-o[0])**2+(b[1]-o[1])**2+(b[2]-o[2])**2),(c[0]-o[0])/m.sqrt((c[0]-o[0])**2+(c[1]-o[1])**2+(c[2]-o[2])**2)], [(a[1]-o[1])/m.sqrt((a[0]-o[0])**2+(a[1]-o[1])**2+(a[2]-o[2])**2),(b[1]-o[1])/m.sqrt((b[0]-o[0])**2+(b[1]-o[1])**2+(b[2]-o[2])**2),(c[1]-o[1])/m.sqrt((c[0]-o[0])**2+(c[1]-o[1])**2+(c[2]-o[2])**2)], [(a[2]-o[2])/m.sqrt((a[0]-o[0])**2+(a[1]-o[1])**2+(a[2]-o[2])**2),(b[2]-o[2])/m.sqrt((b[0]-o[0])**2+(b[1]-o[1])**2+(b[2]-o[2])**2),(c[2]-o[2])/m.sqrt((c[0]-o[0])**2+(c[1]-o[1])**2+(c[2]-o[2])**2)]])
#! /usr/bin/env python3
"""
Simple pomodoro tracker that has been heavily customized to my personal needs.
Each pomodoro will wait for user input before continuing on meaning that
working a little long into your break does not reduce the duration of your
break (the break timer doesn't start until you press enter). When it is time
to move on, pomodoro will present a notification repeatedly using libnotify.
import random
import time
class Item():
def __init__(self, x, y, z, width, height, depth):
self.x = x
self.y = y
self.z = z
self.width = width
self.height = height
import enchant
d = enchant.Dict("en_US")
num_mappings = {
1: [],
2: ['a', 'b', 'c'],
3: ['d', 'e', 'f'],
4: ['g', 'h', 'i'],
5: ['j', 'k', 'l'],
# These are the people who are invited to my wedding
GUESTS = [
"Linda",
"Paige",
"Lauren",
"Melissa",
"Ragnor",
"Thor",
"Gertrude",
"Yoshi",
#include <stdio.h>
#include <cmath>
struct TalonPIDConfig {
float p = 0.0;
float i = 0.0;
float d = 0.0;
float f = 0.0;
};