Skip to content

Instantly share code, notes, and snippets.

View jffry's full-sized avatar
💭
<script>alert('👋')</script>

Jeffrey Stanton jffry

💭
<script>alert('👋')</script>
  • <script>alert("company");</script>
  • <script>navigator.geolocation.getCurrentPosition(alert);</script>
View GitHub Profile
@jffry
jffry / inkplate10_hurricane.ino
Last active September 1, 2024 15:55
Inkplate 10 code to show current hurricane forecast
/*
Shows the current Atlantic tropical weather outlook from the National Hurricane Center,
which is a part of the US NOAA. Refreshes hourly to ensure the image is up to date
(the actual forecast usually updates twice per day)
Automatically sleeps between refreshes so this is extremely battery efficient.
Written by Jeffrey Stanton; I release this code under the terms of CC0-1.0
(https://creativecommons.org/publicdomain/zero/1.0) in the hopes you will
find something useful in here for your own cool projects!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>puppy.jpg</title>
<style>
/* nothing to see here */
img {
width: 300px;
@jffry
jffry / gen.clj
Created November 18, 2019 01:57
Clojure/conj 2019 Schedule
;; Run me with:
;; clojure -Sdeps '{:deps {org.jsoup/jsoup {:mvn/version "1.12.1"}}}' gen.clj
(require '[clojure.string :as str])
(import (java.time.format DateTimeFormatter)
(java.time LocalDate LocalTime ZoneId ZonedDateTime)
(java.util UUID)
(org.jsoup Jsoup)
(org.jsoup.nodes Document))
@jffry
jffry / Cargo.toml
Last active December 13, 2018 02:05
"Perfect" Advent Calendars
[package]
name = "advent-calendar"
version = "0.1.0"
authors = ["Jeffrey Stanton <[email protected]>"]
edition = "2018"
[dependencies]
rand = "0.6"
time = "0.1"
@jffry
jffry / ai-colors.clj
Created September 8, 2017 13:49
AI-generated color names
(ns jffry.colors.ai)
(defn rgb
[r g b]
(str "rgb(" r "," g "," b ")"))
;first generation of neural net generated colors from
;http://lewisandquark.tumblr.com/post/160776374467/new-paint-colors-invented-by-neural-network
;first checkpoint - basic, valid RGB values
@jffry
jffry / java-memory-logging.sh
Created January 10, 2017 16:22
Log memory usage of Java every second as it's running
#!/bin/bash
#helper that gives the current unix time, in seconds
function now() {
date -u "+%s"
}
#helper that calculates elapsed ms
START="$(now)"
function elapsed() {
NOW="$(now)"
echo $((NOW-START))
@jffry
jffry / Launcher for Noisli.md
Last active June 19, 2016 13:17 — forked from demonbane/makeapp.sh
Create a wrapped app launcher for Noisli using Chrome on OSX

If you are on OSX and have Chrome installed, you can use it to wrap apps so that they have their own app icon.

To quickly install it, download and run the script, or just open a terminal and run this command:

curl https://gist.githubusercontent.com/jffry/239833b8f3598ebc6e03/raw/make-noisli-app.sh | bash

That will automatically install the app and run it, though subsequently it's like a normal OSX app and you don't need to run this script again.

@jffry
jffry / LateShowBirthday.md
Created November 13, 2015 03:46
LateShowBirthday

Background

Recently the Late Show programmatically generated Happy Birthday videos for over 1000 different names, and uploaded them all to YouTube (for example, "Happy Birthday jeff").

I wanted a nice easy-to-search list of all the videos, so I cobbled together a little javascript in my browser window to do the trick.

Extraction

@jffry
jffry / egg.md
Created September 16, 2015 22:14
Finding the ng-conf easter egg

ng-conf tweeted that they had some easter eggs. YouTube annotations seemed like a good place to hide one, so I scraped the annotations from their videos.

First, can we programmatically get annotations? Yes! Googling around reveals URLs like https://www.youtube.com/annotations_invideo?features=1&legacy=1&video_id=QHulaj5ZxbI

Second, how to get a list of all their video IDs? Quick and dirty! I opened their channel's video list at https://www.youtube.com/user/ngconfvideos/videos and used my browser console to scrape out the video IDs:

@jffry
jffry / rpi-pins.sh
Created August 16, 2015 23:48
Raspberry Pi: GPIO (Raspbian)
# controlling RPI GPIO pins
# has to be run as root
echo -ne 19 > /sys/class/gpio/export
echo -ne out > /sys/class/gpio/gpio19/direction
echo -ne 1 > /sys/class/gpio/gpio19/value
echo -ne 0 > /sys/class/gpio/gpio19/value
echo -ne 19 > /sys/class/gpio/unexport