Skip to content

Instantly share code, notes, and snippets.

View walshbr's full-sized avatar

Brandon Walsh walshbr

View GitHub Profile
// 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;
@walshbr
walshbr / gist:5968989
Last active December 19, 2015 14:28
Styling to make the search bar more subtle.
#searchform{
border-radius:0px;
border-top: 1px solid #E3E3E3;
border-left: 1px solid #E3E3E3;
border-right: 1px solid #E3E3E3;
border-bottom: 1px solid #E3E3E3;
}
@walshbr
walshbr / image_convert.py
Last active August 18, 2016 15:41
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
walshbr / notification.py
Last active August 24, 2016 14:18
Send yourself a notification when a long script finishes. Requires a gmail account for line 25-6. Adaptation of http://stackoverflow.com/questions/26981591/how-to-send-myself-an-email-notification-when-a-suds-job-is-done
# 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 notification.py 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
notification.email_notification_on_completion()
@walshbr
walshbr / nemla-audio.py
Created March 14, 2017 13:39
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):
# 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