Skip to content

Instantly share code, notes, and snippets.

View autr's full-sized avatar
🌓

Gilbert Sinnott autr

🌓
View GitHub Profile
@autr
autr / [@directus-app]config.js
Last active November 18, 2019 16:58
Directus App config for multiple websites
/* eslint-disable */
(function directusConfig() {
/*
Configuration will skin a Directus App instance based on the "contains" value
*/
@autr
autr / subtle-dark-mode.sass
Created April 3, 2020 12:47
SASS - subtle dark mode
// dark mode options...
$invert: true
// differences between dark grays are more visible when inverted into light grays...
$pushInvertedBrightness: 0.01
// color functions...
@autr
autr / AndroidStudio_OpenFrameworks0.11.0
Created June 2, 2020 19:26
Setup guide for Android Studio and OpenFrameworks 0.11.0
# Android Studio with OF 0.11.0
For this guide I am installing Android Studio, Android SDKs and NDKs, and using the Project Generator to generate projects that compile with Android’s build system, gradle.
## Install Android Studio
Install the latest Android Studio from the [download page](https://developer.android.com/studio) (at the time of writing I am using v4.0)
On the splash screen click Next to all standard installation steps
@autr
autr / clone.sh
Created October 7, 2020 17:58
DD Clone Disk
# because I always forget this
sudo dd if=/dev/sdX of=/dev/sdX status=progress bs=64K
@autr
autr / WindowsPopOS_USB
Last active October 8, 2020 15:16
Create Windows Bootable USB from PopOS 20.04 / Linux
# https://github.com/slacka/WoeUSB
sudo woeusb --tgt-fs NTFS -d ./Win10_XXXXXX_EnglishInternational_x64.iso /dev/sdN
# using windows: woe is me
@autr
autr / installWaveshareLCD.sh
Last active February 23, 2021 19:34
Install Waveshare LCD (Raspberry Pi OS Buster, 5.4 Kernel)
##############################################
## DO NOT USE "LCD-show" to install drivers ##
## its dodgy AF and will make you angery ##
##############################################
TYPE=${1:-waveshare32b}
echo 'Installing with type' $TYPE '...'
# [1] CLONE GITHUB
@autr
autr / download.js
Created March 18, 2021 01:54
modern node https file download (2021 and the future)
// request is deprecated and stackoverflow is crusty
const download = async (url, dest) => {
return await new Promise((resolve, reject)=> {
const file = fs.createWriteStream(dest)
const request = https.get(url, (res) => {
if (res.statusCode !== 200) return resolve( res )
const size = res.headers[ 'content-length' ]
let pro = 0
@autr
autr / wait.js
Created March 18, 2021 00:49
async wait / timeout function for JS
const wait = async ms => ( new Promise(resolve => setTimeout(resolve, ms) ) )
module.exports = wait
@autr
autr / timestamp.js
Created March 18, 2021 00:28
vanilla js date and time stamp strings (not bullshit, works)
// so many bullshit javascript tutorials...
const unix = 1615834045 // unix timstamp
const date = new Date( unix * 1000) // multiply
const iso = d.toISOString() // iso timestamp
// -> "2021-03-15T18:47:25.000Z"
const slug = iso.substr(0, 19).replace(/[^\w\-]+/g, '-').replace('T','-') // slug from ISO
@autr
autr / slugify.js
Created April 2, 2021 02:12
Turn a bit of text into a URL-friendly slug
export default text => text.toString().toLowerCase()
.replaceAll(' ', '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -