Skip to content

Instantly share code, notes, and snippets.

View emlyn's full-sized avatar

Emlyn Corrin emlyn

View GitHub Profile
@emlyn
emlyn / ms_ssi.js
Last active June 25, 2024 07:34
I keep getting shown the "Stay signed in" page on Microsoft domains, even when I select "don't show this again" - this script will automatically click on "yes" for you every time the page comes up.
// ==UserScript==
// @name Stay signed in to MS
// @description Automatically click "yes" on the Microsoft "stay signed in" page that keeps appearing.
// @downloadURL https://gist.github.com/emlyn/2f0c9702bd83fe7d232ed58626c90ac7/raw/ms_ssi.js
// @updateURL https://gist.github.com/emlyn/2f0c9702bd83fe7d232ed58626c90ac7/raw/ms_ssi.js
// @namespace https://gist.github.com/emlyn/
// @version 0.6
// @author Emlyn Corrin
// @match https://login.microsoftonline.com/*
// @match https://login.live.com/*
@emlyn
emlyn / dbws.js
Last active August 10, 2022 13:19
Tampermonkey: Display workspace name at top of Databricks page
// ==UserScript==
// @name Databricks Workspace
// @description Display workspace name at top of Databricks page
// @downloadURL https://gist.github.com/emlyn/169af82a09c2af8d79494f8d7e7d90b1/raw/dbws.js
// @updateURL https://gist.github.com/emlyn/169af82a09c2af8d79494f8d7e7d90b1/raw/dbws.js
// @namespace https://gist.github.com/emlyn
// @version 0.4
// @author Emlyn Corrin
// @match https://*.azuredatabricks.net/*
// @icon https://databricks.com/favicon.ico
@emlyn
emlyn / microtones.rb
Created September 23, 2021 15:35
Microtonal experiment with Sonic Pi
use_bpm 100
root = 220
chords = [[1/1.0, 5/4.0, 3/2.0],
[3/2.0, 15/8.0, 9/4.0],
[9/8.0, 45/32.0, 27/16.0],
[9/8.0, 3/2.0, 9/5.0],
[3/2.0, 2/1.0, 24/10.0],
[1/1.0, 5/4.0, 3/2.0]]
@emlyn
emlyn / code.py
Last active April 16, 2021 22:14
Bad breaking names
# Requires: pip install unidecode
import gzip
import re
import unidecode
# From https://sciencenotes.org/list-elements-atomic-number/, contains:
# - Atomic number
# - Symbol
# - Name
# I set myself a challenge to code a piece using only white noise.
# White noise contains equal amounts of energy at every (audible) frequency.
# It sounds like this:
#synth :noise
# Not very musical.
# But... it contains every frequency, so every possible sound or piece of music
# is hidden in there somewhere... you just have to filter out the parts you don't want.
# The Secret Garden by Pauline Hall
use_synth :saw
use_bpm 100
use_midi_defaults channel: 1
# play note/chord
define :pl do |ns, t, p=0.8|
if not ns.respond_to?('each')
ns = [ns]
let tail_y = 0
let tail_x = 0
let head_y = 0
let head_x = 0
let eaten = false
let score = 0
let dir = 0
let food_y = 0
let food_x = 0
let alive = false
@emlyn
emlyn / soundboard.md
Last active April 30, 2021 21:11
Sonic Pi Soundboard controlled from your phone
  • Install Control on your phone (for Android, but it, or something similar, is probably available for iOS).
  • Run it, tap on "menu", then "Destinations", and then the "+" symbol. For the destination URL enter the IP address of your computer running Sonic Pi, and for the destination port enter 5005, then click "Add".
  • In your terminal, run the soundboard.sh script (or just copy and paste the last line). This listens on a public port and forwards any UDP packets to Sonic Pi (because Sonic Pi only listens on localhost).
  • Copy and paste the soundboard.rb code into a Sonic Pi buffer and run it.
  • In the Control app, tap on "Interfaces" and select "Monome Emulation".
  • Tap the grid, and you should hear sounds.
  • The sliders adjust volume and low-pass cutoff.
@emlyn
emlyn / smoke.md
Last active March 14, 2023 23:40
Smoke on the Water
@emlyn
emlyn / guitar.rb
Last active January 5, 2025 09:24
Strumming guitar chords in Sonic Pi
# Guitar Strumming - by Emlyn
# This tries to work out the guitar (or ukulele etc.) fingering for arbitrary chords (and tuning).
# It seems to work reasonably well for basic chords, but is quite naive and probably makes many mistakes.
# Ideas, bug reports, fixes etc. gratefully received, just comment below, or tweet @emlyn77.
# Feel free to make use of this code as you like (with attribution if you feel like it, but you don't have to).
# Thanks to @Project_Hell_CK for fixing the tuning, and spotting that it gets chord(:f, :major) not quite right.
# Next note higher or equal to base note n, that is in the chord c
define :next_note do |n, c|
# Make sure n is a number