Skip to content

Instantly share code, notes, and snippets.

View vigevenoj's full-sized avatar

Jacob Vigeveno vigevenoj

View GitHub Profile
@vigevenoj
vigevenoj / images-test.clj
Created May 9, 2021 19:38
imgproxy url signing in clojure
(ns doggallery.images-test
(:require [clojure.test :refer :all]
[buddy.core.codecs :as codecs])
(:require [example.images :refer :all]))
(deftest imgproxy-url-generation
; this test replicates the java upstream
; https://github.com/imgproxy/imgproxy/blob/master/examples/signature.java
(testing "generate signed url for imgproxy"
@vigevenoj
vigevenoj / certs.clj
Last active March 20, 2021 05:32
have a cert? need a socket factory with that cert as a trusted root? this does that.
(ns church.buttstuff.certs
(:require
[clojure.java.io :as io]
(:import
(java.security Keystore)
(java.security.cert CertificateFactory)
(javax.net.ssl SSLContext)
(javax.net.ssl TrustManagerFactory)))
(defn use-custom-ssl?
@vigevenoj
vigevenoj / core.clj
Created April 20, 2020 05:07
javafx semicircle using cljfx
(ns semicircle.core
(:require
[cljfx.api :as fx]
(:import
[javafx.application Platform]
[javafx.scene.paint Color]
[javafx.scene.canvas Canvas])
(:gen-class))
(def *state
@vigevenoj
vigevenoj / list-hue-bulbs.py
Created December 31, 2018 21:54
pretty-print hue bulbs with id, model, serial number, and name
#! /usr/bin/env python3
import argparse
from phue import Bridge
def main(bridge_ip):
bridge = Bridge(bridge_ip)
api = bridge.get_api()
lights = api['lights']
for light in lights:
@vigevenoj
vigevenoj / rivertemp.py
Created November 27, 2018 06:28
current temperature of the Willamette River by the Morrison Bridge in PDX
import requests
import json
url = "https://waterservices.usgs.gov/nwis/iv/?site=14211720&format=json"
response = requests.get(url)
# there's probably a better way to get here than this blob
data = response.json()['value']['timeSeries'][0]['values'][0]['value']
print(data)
@vigevenoj
vigevenoj / lantern.py
Created October 13, 2017 15:50
neopixel lantern scratchpad
import machine
import neopixel
import time
def cycle(np):
n = np.n
for i in range(4 * n):
for j in range(n):
np[j] = (0, 0, 0)
@vigevenoj
vigevenoj / Interview.java
Created July 7, 2017 05:07
sample interview question and solution(s) because there's definitely more than one way to solve a problem
import java.io.*;
import java.util.*;
public class Interview {
private static int findMissing(int[] array) {
int length = array.length;
// This three-line implementation is better but possibly less easy to understand.
// We use some math here: sum the numbers from 1 to (length + 1)
#! /usr/bin/env bash
# This is to work around https://github.com/mitchellh/vagrant/issues/7747
#
# 1) Link the Vagrant-provided openssl executable to the right dylibs
# 2) Set OPENSSL_CONF to the actual location of the configuration file
# instead of /vagrant-substrate/staging/embedded, which doesn't exist
set -e
sudo install_name_tool -change "/vagrant-substrate/staging/embedded/lib/libssl.1.0.0.dylib" "/opt/vagrant/embedded/lib/libssl.1.0.0.dylib" /opt/vagrant/embedded/bin/openssl
@vigevenoj
vigevenoj / weather_alerts.py
Last active August 22, 2021 21:47
NWS/NOAA weather alert fetcher derived from https://github.com/greencoder/noaa-alerts-pushover
import time
import lxml.etree
import requests
# import dateutil.parser as dateparser
import cachetools
from time import strftime
from apscheduler.schedulers.background import BackgroundScheduler
ATOM_NS = "{http://www.w3.org/2005/Atom}"
@vigevenoj
vigevenoj / location_to_lcd.rb
Last active September 30, 2016 04:56
poop latest phone location onto ssd1306 lcd
!# /usr/bin/env ruby
require 'mqtt'
require 'json'
require 'yaml'
require 'bigdecimal'
require 'logger'
require 'SSD1306'
require 'rufus-scheduler'