Skip to content

Instantly share code, notes, and snippets.

View nrrb's full-sized avatar
🤔

Nicholas Bennett nrrb

🤔
View GitHub Profile
@nrrb
nrrb / scrolling_spectrogram.java
Created November 7, 2023 17:55
Scrolling Spectrogram in Processing using Sound library
import processing.sound.*;
FFT fft;
AudioIn in;
int bands = 512;
float[] spectrum = new float[bands];
void setup() {
size(512, 600);
background(255);
@nrrb
nrrb / selenium_basics.py
Created April 16, 2012 22:18
Selenium stuffs
from selenium import webdriver
profile = webdriver.FirefoxProfile()
# Set proxy settings to manual
profile.set_preference('network.proxy.type', 1)
# Set proxy to Tor client on localhost
profile.set_preference('network.proxy.socks', '127.0.0.1')
profile.set_preference('network.proxy.socks_port', 9050)
# Disable all images from loading, speeds page loading
# http://kb.mozillazine.org/Permissions.default.image
@nrrb
nrrb / circles.tex
Last active November 30, 2019 06:49
Using LaTeX to make circles on an equilateral triangle grid. Seed of Life Coloring Book.
\documentclass[a4paper]{article}
\usepackage{tikz}
\usepackage[left=0cm,top=2cm,right=0cm,bottom=0cm,nohead,nofoot]{geometry}
\usepackage{xcolor}
\begin{document}
\begin{tikzpicture}
\pgfmathsetmacro{\r}{3}
% Given that A4 paper is 21cm x 29.7 cm, we can calculate the maximum number of circles that will fit on the page based on the radius
@nrrb
nrrb / AllInOne.py
Last active November 30, 2019 06:47
My first Python script. Replicating and enhancing functionality of a Processing (Java) applet.
from TileImageClass import TileableImage
from TiledImageClass import TiledImage
import random
import Image
#import ImageDraw
import time
target_size = 256
tile_size = 64
image_source_folder = "./images/"
@nrrb
nrrb / sirdspos.asm
Last active November 30, 2019 06:20
185 byte x86 assembly code to create a stereogram of text.
; SIRDS Piece Of Shiite
; by danslemur (nick@jtan.com)
; for EFnet #asm compo 7 - Make a 256 byte intro for 386/486 class PC's
;
; I got bored and didn't fill in the whole 256 bytes. It's 185 bytes now. Eh!
;
; Thanks to:
; - Razzia for his helpful size optimization post on www.movnet.org/forum,
; - matja for showing me a better way to write a 4x4 block to the buffer,
; - Consub/CSB for the source to his Chaos demo which I borrowed the pseudo-
@nrrb
nrrb / nrrb.py
Created November 1, 2019 16:51
Making silly phrases out of initials
from random import choice
from functools import reduce
with open('mobypos.txt', 'r', encoding='latin1') as f:
moby_words = [line.strip() for line in f.readlines()]
words = [dict(zip(['word', 'pos'], moby_word.split('\\'))) for moby_word in moby_words]
pos_key = {
'Noun': 'N',
@nrrb
nrrb / contractors.csv
Last active February 6, 2019 05:39
Scraping Chicago's Department of Buildings list of general contractors using selenium.
We can't make this file beautiful and searchable because it's too large.
Phone,Address,Lic Expr,Company Name,License Type
(773)342-1988,3966 WEST GRAND AVENUE  CHICAGO  IL 60651,06/24/2014,#1 QUALITY CHOICE INC,"E - $500,000 PROJECT CEILING"
(312)656-8984,1119 BLANCHAN AVE.  LA GRANGE PARK  IL 60526,06/20/2014,"(XRB) CONSTRUCTION SERVICES, LLC.","E - $500,000 PROJECT CEILING"
(312)256-4251,2210 N LAPORTE  CHICAGO  IL 60639,11/11/2014,"1 VISION CONSTRUCTION COMPANY, INC","E - $500,000 PROJECT CEILING"
(224)402-4282,1011 WOODLAND DR.  GLENVIEW  IL 60025,05/28/2014,"1-KJO HOLDING, LLC.","E - $500,000 PROJECT CEILING"
(773)342-8200,1001 NORTH MILWAUKEE AVENUE SUITE 400 CHICAGO  IL 60622,07/07/2014,1001 NORTH INCORPORATED,"D - $2,000,000 PROJECT CEILING"
(877)685-6095,5070 N. KIMBERLY AVE. UNIT C CHICAGO  IL 60630,11/24/2014,"123 REMODELING, INC","D - $2,000,000 PROJECT CEILING"
(773)842-9406,4919 N. MOBILE AVENUE  CHICAGO  IL 60630,01/18/2015,"1248 W GRACE, LLC","D - $2,000,000 PROJECT CEILING"
(630)327-4614,"1639 W. WALNUT STREET, UNIT 202  CHICAGO  IL 60612",08/27/2014
@nrrb
nrrb / r-rstudio-tinytex-faq.markdown
Last active January 8, 2019 19:15
FAQs related to installing R, RStudio, TinyTeX at Kellogg

FAQs for Installing R, RStudio, and TinyTeX

@ Kellogg School of Management

1. /usr/local/bin not writable

I see this error when I install TinyTeX:

add_link_dir_dir: destination /usr/local/bin not writable, no links from /Users/hagen/Library/TinyTeX/bin/x86_64-darwin. add of symlinks had 1 error(s), see messages above. add of symlinks had 1 error(s), see messages above. tlmgr: An error has occurred. See above messages. Exiting.

This is an issue on some Macs, where that folder /usr/local/bin is not writable by your user account for some reason. Here's how to fix it:

@nrrb
nrrb / Makefile
Last active November 28, 2018 21:36
Periodic Screenshots (every 10 seconds) on Mac OS X
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " screencap To start recording screencaps and clean up yesterday's captures."
@echo " cleanyesterday Just delete yesterday's captures."
@echo " captoday Just start recording screencaps for today."
screencap:
./remove_yesterday_recording.sh
./start_recording.sh
@nrrb
nrrb / beer_menu.thor
Created January 27, 2018 04:59 — forked from cadwallion/beer_menu.thor
Ruck beer list scraper
#!/usr/bin/env ruby
# A Thor-based commandline tool for all BeerMenu.
# Based on @jsteiner's Ruby equivalent of @jlet's Python Ruck
# beer list scraper
# @jsteiner's Original: https://gist.github.com/2703889
# @jlet's Original: ttps://gist.github.com/2659721
require 'open-uri'
require 'nokogiri'