Skip to content

Instantly share code, notes, and snippets.


Brandon Walsh walshbr

View GitHub Profile
# import necessary packages for webscraping.
from dataclasses import replace
from bs4 import BeautifulSoup
from urllib import request
from dateutil.parser import parse
import time
import random
import os
import re
walshbr /
Created Mar 14, 2017
implements audiogrep and pydub to cut up and reassemble audio
# Python 2
import os
from subprocess import call
from pydub import AudioSegment
def manifest(directory, extension=None):
# gives all the file names in the directory.
for (root, _, files) in os.walk(directory):
walshbr /
Last active Aug 24, 2016
Send yourself a notification when a long script finishes. Requires a gmail account for line 25-6. Adaptation of
# stick in the root of your directory, then you can import it as a package to be added to the end of a long process.
# Be sure to add to your .gitignore file to prevent accidentally sharing sensitive personal information.
# =====
# In file that takes forever to run
# At top of file
import notification
# As last line before file end
walshbr /
Last active Aug 18, 2016
Crawls over all .png images in a directory and compresses them by converting to jpg. Deletes pngs afterwards. Ignores non .png files. Run from root of the directory you want to crawl over.
import os
from PIL import Image
def all_files(dirname):
for (root, _, files) in os.walk(dirname):
for fn in files:
yield os.path.join(root, fn)
walshbr / gist:5968989
Last active Dec 19, 2015
Styling to make the search bar more subtle.
View gist:5968989
border-top: 1px solid #E3E3E3;
border-left: 1px solid #E3E3E3;
border-right: 1px solid #E3E3E3;
border-bottom: 1px solid #E3E3E3;
View Arduino Rainbow Hack
// Piezo speaker connected to pins
int speakerPin = 6;
// RGB LED leads connected to PWM pins
const int RED_LED_PIN = 9;
const int GREEN_LED_PIN = 10;
const int BLUE_LED_PIN = 11;
// Used to store the current intensity level of the individual LEDs
int redIntensity = 0;
int greenIntensity = 0;