Skip to content

Instantly share code, notes, and snippets.

View lopugit's full-sized avatar

Nikolaj lopugit

View GitHub Profile
@lopugit
lopugit / apple-music-volume-sync-with-system.js
Created September 9, 2024 06:11
Sync Apple Music Volume with System Volume Node.js Apple Script
// set the Apple Music Volume to the same level as the system volume
// OSX MAC ONLY
const { exec } = require('child_process');
const getVolume = () => {
return new Promise((resolve, reject) => {
exec('osascript -e "output volume of (get volume settings)"', (err, stdout, stderr) => {
if (err) {
reject(err);
} else {
@lopugit
lopugit / gist:9e00dfee651269c20610d125fe51c0db
Created February 21, 2024 00:55
Multi SSH KEY config for same hosts based on directory
Finally, multi ssh key config for same host git repo's :exploding_head:
https://superuser.com/questions/366649/ssh-config-same-host-but-different-keys-and-usernames
Alternative Git configuration to automatically switch accounts depending on repo path:
Create a file ~/.config/git/config.user1 containing:
[url "github_username1:"]
insteadOf = [email protected]:
Create a config.user2 file that's the same except with "github_username2".
@lopugit
lopugit / Marketing.txt
Last active February 20, 2024 00:47
Gmail text match OR filter for marketing/spam
("unsubscribe" | "Unsubscribe" | "unsub" | "Unsub" | "Manage your subscription" | "Manage subscription" | "do not want to receive marketing emails" | "Click here if you wish to stop the distribution" | "opt out" | "Opt out" | "Click here and we'll never email you")
@lopugit
lopugit / gist:9b51101c958ef1d9a21936477e651cda
Created May 15, 2022 08:01
Nginx/Valet Homebrew config location
/opt/homebrew/etc/nginx/nginx.conf
@lopugit
lopugit / postcodeToState.js
Created December 23, 2021 01:48
Get Victorian State code based on a postcode
const postcode = 9999
let state
if (
(postcode >= 1000 && postcode <= 2599) ||
(postcode >= 2619 && postcode <= 2899) ||
(postcode >= 2921 && postcode <= 2999)
) {
state = 'NSW'
} else if (
(postcode >= 200 && postcode <= 299) ||
@lopugit
lopugit / words.json
Created August 1, 2021 13:34
Just a JSON importable list of over 300,000 english dictionary words
This file has been truncated, but you can view the full file.
["2","1080","&c","10-point","10th","11-point","12-point","16-point","18-point","1st","2,4,5-t","2,4-d","20-point","2D","2nd","30-30","3D","3-D","3M","3rd","48-point","4-D","4GL","4H","4th","5-point","5-T","5th","6-point","6th","7-point","7th","8-point","8th","9-point","9th","a","a'","a-","A&M","A&P","A.","A.A.A.","A.B.","A.B.A.","A.C.","A.D.","A.D.C.","A.F.","A.F.A.M.","A.G.","A.H.","A.I.","A.I.A.","A.I.D.","A.L.","A.L.P.","A.M.","A.M.A.","A.M.D.G.","A.N.","a.p.","a.r.","A.R.C.S.","A.U.","A.U.C.","A.V.","a.w.","A.W.O.L.","A/C","A/F","A/O","A/P","A/V","A1","A-1","A4","A5","AA","AAA","AAAA","AAAAAA","AAAL","AAAS","Aaberg","Aachen","AAE","AAEE","AAF","AAG","aah","aahed","aahing","aahs","AAII","aal","Aalborg","Aalesund","aalii","aaliis","aals","Aalst","Aalto","AAM","AAMSI","Aandahl","A-and-R","Aani","AAO","AAP","AAPSS","Aaqbiye","Aar","Aara","Aarau","AARC","aardvark","aardvarks","aardwolf","aardwolves","Aaren","Aargau","aargh","Aarhus","Aarika","Aaron","Aaronic","Aaronical","Aaronite","Aaronitic","Aaron's-beard",
@lopugit
lopugit / gist:dcff73fe104e5897599972bfcfd8aedd
Created January 29, 2021 04:28
run root command in wsl without starting user session, for recovering broke wsl init configs
If you only need to remove the script, try from cmd wsl.exe -u root -e rm /etc/profile.d/00-wsl2.systemd.sh.
If you have bad startup config in /etc/wsl.conf, perhaps you can run wsl -u root -e mv /etc/wsl.conf /etc/wsl.conf.bak.
EDIT: you know what -u root does, don't you ;) As for -e, it means do not invoke the default login shell and run the rm or mv binaries directly.
@lopugit
lopugit / Launch current node.js file VS code launch.json debugger debug
Created May 13, 2020 12:36
Launch current node.js file VS code launch.json debugger debug
{
"type": "node",
"request": "launch",
"name": "Current File",
"program": "${workspaceFolder}/${relativeFile}",
"skipFiles": [
"<node_internals>/**"
]
}
@lopugit
lopugit / set-up-chromium-keys.md
Created December 15, 2019 08:31 — forked from ezeeyahoo/set-up-chromium-keys.md
Launch Chromium with API Keys on Mac OS X and Windows

Sometimes you need to use API Keys to use things like the Speech API. And then you Google a bit and follow all the instructions. But the Chromium Project's API Keys page does a not-so-great of explaining how to do this, so I will.

  1. Download Chromium.[Unofficial/Unstable/Latest build] OR Download from https://github.com/macchrome/chromium/releases (stable)
  2. You'll notice a yellow disclaimer message appear as a doorhanger: Google API Keys are missing. Some functionality of Chromium will be disabled. Learn More.
  3. Clicking on that link takes you to the confusing API Keys docs page.
  4. If you aren't already, subscribe to the [email protected] mailing list. (You can just subscribe to the list and choose to not receive any mail. FYI: the C
@lopugit
lopugit / DeterminingFunctionTypes.js
Created December 10, 2019 11:55
Determining function types
const flags = {
function: f instanceof Function,
name: undefined,
native: false,
bound: false,
plain: false,
arrow: false
};
if (flags.function) {