Skip to content

Instantly share code, notes, and snippets.

@jasco
jasco / README.md
Last active February 17, 2024 20:47
ARM64 Raspberry Pi 4 Unifi Controller Setup

Background

The instructions for setting up the Unifi Controller on ARM do not cover ARM64. The documentation states that ARM64 is not supported but hints it can be setup manually. The documentation also states that Java 8 is currently required. The following is therefore clearly in unsupported territory but so far seems to work fine. The internet has numerous references and resources but they weren't all easy to find and the ones I read required some modification for my configuration.

Note for the future: double check versions and source documentation if these instructions are dated. Also these instructions are specifically tailored for Ubuntu. See original references for other platforms.

Last update March 25, 2021

Base configuration

@jasco
jasco / README.md
Last active March 20, 2021 11:31
Rebuild virtualenv symlinks after python upgrade

After upgrading Python, the virtualenv Python symlinks sometimes break. This will manifest as an error when invoking Python within the target virtualenv. This script walks through each virtualenv directory searching for broken links. It will recreate the virtualenv if necessary. It is intended to work with a virtualenvwrapper managed environment in which all virtual environments are centralized under a specific directory.

Assumptions:

  • Virtual environments collected under $HOME/.virtualenvs/
  • GNU compatible find is called gfind.
  • virtualenv command is located at /usr/local/bin/virtualenv
@jasco
jasco / sample.css
Created January 23, 2021 06:18
HTML Video Background #html #web
.vid_bg {
position: absolute;
display: block;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
pointer-events: none;
transition: display .3s;
@jasco
jasco / SPPachabelCanon.rb
Last active June 12, 2020 08:24 — forked from rbnpi/SPPachabelCanon.rb
Sonic Pi Pachabel's Canon for Flute, Clarinet and Trombone sample based voices. This version runs on RPi
# Pachebel Canon for Sonic Pi, played by Flute, Clarinet and Trombone sample based voices
# coded by Robin Newman, March 2015
# modified to work with SonicPi 3.2.2 (min unknown)
# score from www.freegigmusic.com (version for flute oboe and clarinet)
# samples download at http://r.newman.ch/rpi/Pachabel.zip
use_debug false
samples_dir='/home/pi/samples/Pachabel' #adjust location as necessary
# first deal with selecting and setting up the samples
inst0=samples_dir + '/flute_ds5.wav'
@jasco
jasco / download_fetched_response.js
Last active April 2, 2020 07:48
Browser download from fetched data
// Most samples used createObjectURL which gave errors suggesting no longer supported by the browser.
// This implementation encodes as a base64 string and saves as an octet-stream.
// Adapted from https://stackoverflow.com/a/38384008 and https://stackoverflow.com/a/11562550
function download(filename, arrayBuffer) {
const element = document.createElement('a');
const base64String = btoa(String.fromCharCode(...new Uint8Array(arrayBuffer)));
element.setAttribute('href', 'data:application/octet-stream;base64,' + base64String);
element.setAttribute('download', filename);
element.style.display = 'none';
document.body.appendChild(element);
@jasco
jasco / 99_facetimehd
Last active February 27, 2020 01:09
ubuntu facetimehd kernel module build
#!/bin/bash
set -e
# References
# - https://github.com/patjak/bcwc_pcie/wiki/Get-Started#get-started-on-ubuntu
# - https://gist.github.com/Stono/990ea9f0b3c41606c292f00382d421bf
git clone https://github.com/patjak/bcwc_pcie.git /tmp/bcwc_pcie
cd /tmp/bcwc_pcie
git clone https://github.com/patjak/facetimehd-firmware.git
@jasco
jasco / csv_upload.py
Last active March 20, 2024 17:41
Python3 Flask CSV parsing of uploaded file
# Python3 implementation for CSV parsing of uploaded file
# Test: curl -H "Content-Type: multipart/form-data" -F "file=@mydata.csv" http://localhost:5000/myroute
import csv
import codecs
from flask import (jsonify, request)
# ...
@app.route('/myroute', methods=['POST'])
@jasco
jasco / README.md
Created October 17, 2017 08:30
ARM Debian Config for Kyocera FS-4020DN

Kyocera FS-4020DN Laser Printer Config

Install CUPS

sudo apt update && apt dist-upgrade
sudo apt install cups openprinting-ppds

Add user to printer group

sudo usermod -a -G lpadmin $USER
@jasco
jasco / get_etag.pl
Last active May 26, 2022 20:46
Apache Use Stored MD5 as ETAG
#!/usr/bin/perl
use strict;
$| = 1; # Turn off I/O buffering
sub sanitize {
my $fname = $_[0];
$fname =~ s#[^-_a-zA-Z0-9./]*##g;
$fname =~ s#/\.\.+/##g;
@jasco
jasco / migrator.sh
Last active July 14, 2017 08:24 — forked from vigneshwaranr/migrator.sh
Script to convert SQLITE dumps into PostgreSQL compatible dumps
#! /bin/sh
usage_error () {
echo 'Usage: sh migrator.sh <path to sqlite_to_postgres.py> <path to sqlite db file> <an empty dir to output dump files>'
echo
echo 'Example:'
echo '>sh migrator.sh sqlite_to_postgres.py ~/reviewboard.db /tmp/dumps'
echo
echo 'Tested on:'
echo 'Python 2.7.3'