Skip to content

Instantly share code, notes, and snippets.

View swhitt's full-sized avatar
:shipit:
squirrel

Steve Whittaker swhitt

:shipit:
squirrel
View GitHub Profile
@swhitt
swhitt / twinkly_last_lights.py
Last active January 16, 2024 19:54
Python script to light up the last LED on each string of Twinkly LED lights using the `xled` library.
#!/usr/bin/env python3
"""
This script was written to help me find the end light on each strand of my
Twinkly Christmas Lights. It's much easier to remove the lights from the tree
when you know where the end is. :)
Upon execution, the script automatically discovers all Twinkly devices on your
local network and illuminates the last LED of each strand with a random color.
Realtime mode on the devices has a duration of 60 seconds. The strands will
def part1
times, distances = input_lines.map { |line| line.scan(/\d+/).map(&:to_i) }
calculate_wins(times.zip(distances))
end
def part2
calculate_wins([input_lines.map { |line| line.delete("^0-9").to_i }])
end
def calculate_wins(races)
@swhitt
swhitt / xterm-256color.terminfo
Last active March 31, 2019 05:19
from my mojave install
# Reconstructed via infocmp from file: /usr/share/terminfo/78/xterm-256color
xterm-256color|xterm with 256 colors,
am, bce, ccc, km, mc5i, mir, msgr, npc, xenl,
colors#256, cols#80, it#8, lines#24, pairs#32767,
acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
clear=\E[H\E[2J, cnorm=\E[?12l\E[?25h, cr=^M,
csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
@swhitt
swhitt / truereddit-top-year.md
Last active February 18, 2019 06:17
/r/TrueReddit top posts by year

/r/TrueReddit top posts by year

This was an experiment for me using the Pushshift API / [psaw]. It grabs the top 20 posts (ranked by score / excluding removed submissions) of each year since the subreddit was created.

The first number of each entry is the post score, the second is the number of comments - click to go to the comments. Click a username to view a user page. Click the title of the post to go to the submitted URL.

The API doesn't include proper scores for posts made after September 2018 yet so it stops there for now.

@swhitt
swhitt / houston-top-year-comments.md
Created February 18, 2019 05:40
top commented posts of /r/Houston by year

/r/houston most commented posts by year

This was an experiment for me using the [Pushshift API] / [psaw]. It grabs the top 10 posts (ranked by number of comments / excluding removed submissions) of each year since the subreddit was created.

The first number of each entry is the post score, the second is the number of comments - click to go to the comments. Click a username to view a user page. Click the title of the post to go to the submitted URL.

The API doesn't include proper scores for posts made after September 2018 yet so it stops there for now.

@swhitt
swhitt / houston-top-year.md
Last active February 18, 2019 05:43
top posts of /r/Houston by year

/r/houston top posts by year

This was an experiment for me using the [Pushshift API] / [psaw]. It grabs the top 20 posts (ranked by score / excluding removed submissions) of each year since the subreddit was created.

The first number of each entry is the post score, the second is the number of comments - click to go to the comments. Click a username to view a user page. Click the title of the post to go to the submitted URL.

The API doesn't include proper scores for posts made after September 2018 yet so it stops there for now.

@swhitt
swhitt / houston-top.md
Last active February 18, 2019 15:54
top posts of /r/Houston by month

/r/houston top posts by month

This was an experiment for me using the [Pushshift API] / [psaw]. It grabs the top 10 posts (ranked by score / excluding removed submissions) of each month since the subreddit was created.

The first number of each entry is the post score, the second is the number of comments - click to go to the comments. Click a username to view a user page. Click the title of the post to go to the submitted URL.

The API doesn't include proper scores for posts made after September 2018 yet so it stops there for now.

@swhitt
swhitt / tfts-top.md
Last active February 18, 2019 05:46
Top Stories from /r/TFTS, by year

/r/talesfromtechsupport top posts by year

This was an experiment for me using the Pushshift API / [psaw]. It grabs the top 20 posts (ranked by score / excluding removed submissions) of each year since the subreddit was created.

The first number of each entry is the post score, the second is the number of comments - click to go to the comments. Click a username to view a user page. Click the title of the post to go to the submitted URL.

The API doesn't include proper scores for posts made after September 2018 yet so it stops there for now.

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDNlyIHg7FyWw3SBISbSVGXPrFyxaGhCTp1obN7nGtmkY4c4eF6ZE8Qo298E2smE65z6zne05z2HGqyBtWLHDwCIv2wE9VuLVziLTMgzP0NiqvqHe5YTrdnpxq7BLjGGiGVU+4ehWu6t1eYfZDgvkjhPHqLSOV3axoE4qyAcS0wirQ+t5IRveDUsd3i0oi7/F7HOgkST6ckIp51XzY+NJJfrKwBsCHNViYhqo7bW7pcelpBf43y/3aKXPAKMAMIXeVLM0yjdZPtONL+fCB5dUKb6UVOPuXFsYaVeWqxbxkaaoIU/2h6GWrZHZEd0K7MAI+Hiy9aAlkMhPe0okHVnTn/BrbIp2XAu0wq1UC6Wua1jzzFK61/x8XjfhPXPmrT08x74v2iZ0u1PTiL0qp74JhyP4ErfjZsQSK7seSyqqga1z7C+pwDtvd8EVDpia0tqxcXuOi0Okm3RVjh20JMDf1MVRhczMo+FUV0GnijVMHb8eeicSwi60nRARG4lWxWk8QmDZ2NHSHv9EKSp1c9zBn7q7J44mWREe8vTpjGkWpbV1LKvp8NGfrRoJ2o56Egrcz/LiOhUSbcgFRstlRw8Hh+EvdQSiBEEWoWQV3NZjD9z3bsoJ6vqm4uXydiYlOGoPWyePAbLMX/5/jG/joZhQET6m9jUqM2uspFmdH6hm/7/w== openpgp:0x60819EBC