Skip to content

Instantly share code, notes, and snippets.

View AlexLamson's full-sized avatar

Alex Lamson AlexLamson

View GitHub Profile
@AlexLamson
AlexLamson / timestamp.py
Created November 8, 2020 18:59
My preferred way of getting a human-readable timestamp in python
from datetime import datetime
datetime.now().astimezone().strftime('%Y-%m-%d %H:%M:%S %Z')
@AlexLamson
AlexLamson / minim_microphone_fft.pde
Created March 20, 2018 02:27
Realtime FFT from the microphone with the minim processing library
import ddf.minim.analysis.*;
import ddf.minim.*;
Minim minim;
AudioSource in;
FFT fft;
void setup() {
size(512, 200);
@AlexLamson
AlexLamson / metronome.py
Created May 27, 2017 02:29
Python script to create tones every 5, 10 and 30 seconds. Useful for timing stretching exercises.
import os
import time
import math
'''
Note:
Requires the `sox` package, which can be installed with the following command:
sudo apt-get install sox
'''
@AlexLamson
AlexLamson / backup-rescuetime.py
Last active May 6, 2020 19:08
A simple python script to backup rescuetime data every month
#!/usr/bin/python3
# backup-rescuetime.py: Backup all of last month's rescuetime data
#
# Columns are Date,Time Spent (seconds),Number of People,Activity,Category,Productivity
# Rows are hourly breakdowns of the activities done
#
# Must have directory called 'rescuetime_data' in same directory as script
#
# Sample crontab entry to backup at 6AM on the 1st of every month:
# 0 6 1 * * python3 ~/rescuetime/backup-rescuetime.py
@AlexLamson
AlexLamson / rasp-pi-umass-eduroam.md
Last active March 8, 2023 15:59
How to connect to UMass Eduroam wifi with a Raspberry Pi running Raspbian

How to connect Raspberry Pi to UMass Eduroam

Open up a terminal and move into the directory holding the wpa_supplicant config file.

cd /etc/wpa_supplicant

You may want to backup your config file before you do anything just in case.

sudo cp wpa_supplicant.conf ~/Desktop/wpa_supplicant.conf
@AlexLamson
AlexLamson / readme.md
Last active March 18, 2017 02:02 — forked from endolith/readme.md
How to stream a webcam to a web browser in Ubuntu

Grr this took hours to figure out. I was trying to install MJPG-streamer and running VLC command lines and all this crap but nothing worked.

First install motion:

~> sudo apt-get install motion

Then create a config file:

~> mkdir ~/.motion

~> nano ~/.motion/motion.conf

@AlexLamson
AlexLamson / random_cow.sh
Created March 10, 2017 22:52
Make a random cow say "Hello"
#sudo apt install -yqqq figlet cowsay
figlet -f $(ls /usr/share/figlet/*.flf | shuf -n1) "Hello" | cowsay -n -f $(ls /usr/share/cowsay/cows/ | shuf -n1)
import sys, pygame
from pygame import Rect
from pygame.locals import *
size = width, height = 640, 480
pos = (0, 0) #mouse position
inital_drag_pos = (0, 0)
dragging = False
@AlexLamson
AlexLamson / commands.txt
Last active November 2, 2021 16:40
List of useful terminal commands for a beginner. Sorted approximately by difficulty & usefulness.
Commands
---------------
man # MANual for command
ls # LiSt files (-l more information, -R recursive)
cd # Change Directory (if no folder, go home)
pwd # Print Working Directory
mkdir -p # MaKe DIRectory (-p create missing parent directories)
touch # create file
rm -fr # ReMove directory and all its contents
[TAB key] # press tab key to autocomplete filename or command
@AlexLamson
AlexLamson / color.sh
Created June 25, 2016 23:50
Bash script that colors some given input text using ANSI escape codes
#color.sh
#Usage:
# ./color.sh somecolor some text to be colored
#ex. ./color.sh lightblue hello world
color='\033[0m'
nocolor="\033[0m"
case "$1" in
black) color="\033[0;30m";;