Skip to content

Instantly share code, notes, and snippets.

View rogerwalt's full-sized avatar

row rogerwalt

  • Zurich, Switzerland
View GitHub Profile
Workaround from snabb, https://github.com/systemd/systemd/issues/6076
My current workaround is to do the following tricks every time I start my workplace VPN:
1. Find out the link number (a.k.a. interface index) of the ISP interface: systemd-resolve --status or ip l.
2. Connect the VPN.
3. Remove DNS settings from the ISP interface (using the link number from step 1) by sending a D-Bus command to systemd-resolved. This is an example using link number 2: sudo busctl call org.freedesktop.resolve1 /org/freedesktop/resolve1 org.freedesktop.resolve1.Manager SetLinkDNS 'ia(iay)' 2 0
4. Inspect with systemd-resolve --status to ensure that only the correct DNS servers are there.
Apparently there isn't any simple cli tool for managing systemd-resolved's settings. That busctl command isn't very user-friendly. :)
(´ ͡༎ຶ ͜ʖ ͡༎ຶ )
(╯°□°)╯︵ ┻━┻
⊂_ヽ
  \\ my
   \( ͡° ͜ʖ ͡°)
    > ⌒ヽ
   /   へ\
   /  / \\last
@rogerwalt
rogerwalt / cleanGitBranches.sh
Last active October 3, 2018 07:31
Cleans stale git branches (removed on remote and merged local branches)
git remote prune origin
git branch --merged | egrep -v "(^\*|master|dev)" | xargs -r git branch -d
const fileNames = ['one.js', 'two.scss', 'three.scss'];
const getAllFileNames = () => new Promise((resolve, reject) => { resolve(fileNames) })
const filterScssFiles = (fileNames) => new Promise((resolve, reject) => resolve(fileNames.filter(fileName => fileName.endsWith('.scss'))))
getAllFileNames().then(fileNames => filterScssFiles(fileNames))
.then(scssFileNames => console.log(scssFileNames))
.catch(err => console.error(err))
@rogerwalt
rogerwalt / gist:7300568
Created November 4, 2013 10:06
Windows PowerShell: Create Profile and add Alias to Notepad++ to it.
# create profile
New-Item -path $profile -type file -force
# open it with notepad
notepad $profile
# add alias to notepad++ to it
Set-Alias npp "C:\Program Files (x86)\Notepad++\notepad++.exe"