Skip to content

Instantly share code, notes, and snippets.

View rogerwalt's full-sized avatar

row rogerwalt

  • Zurich, Switzerland
View GitHub Profile
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))
(´ ͡༎ຶ ͜ʖ ͡༎ຶ )
(╯°□°)╯︵ ┻━┻
⊂_ヽ
  \\ my
   \( ͡° ͜ʖ ͡°)
    > ⌒ヽ
   /   へ\
   /  / \\last
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. :)
@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
@rogerwalt
rogerwalt / jspm.sh
Created April 12, 2018 07:26
jspm debug output!
NODE_DEBUG=cluster,net,http,fs,tls,module,timers jspm install
@rogerwalt
rogerwalt / promise.test.js
Last active February 6, 2018 14:33
How to jest promises
/**
* example how to test promises using jest.
* https://facebook.github.io/jest/docs/en/asynchronous.html#promises
*/
function getPromise() {
return new Promise(function (success, reject) {
setTimeout(function() {
success('job is done');
}, 200);
@rogerwalt
rogerwalt / interactiveRebase.md
Created January 30, 2017 07:54
Interactive rebase merge

on branch feature_interview:

  • $ git checkout develop
  • $ git pull
  • $ git checkout feature_interview
  • $ git checkout -b pr_feature_interview
  • $ git rebase -i develop squash all commits, remain one pick
  • $ git commit --ammend (or use git-cola) to change last commit message
  • $ git push origin and create pull request
@rogerwalt
rogerwalt / gist:749e7663e840eadb638777c052ac488e
Created July 26, 2016 13:24
mysql openssl generate keys
# Generate a CA key and certificate with SHA1 digest
openssl genrsa 2048 > ca-key.pem
openssl req -sha1 -new -x509 -nodes -days 3650 -key ca-key.pem > ca-cert.pem
# Create server key and certficate with SHA1 digest, sign it and convert
# the RSA key from PKCS #8 (OpenSSL 1.0 and newer) to the old PKCS #1 format
openssl req -sha1 -newkey rsa:2048 -days 730 -nodes -keyout server-key.pem > server-req.pem
openssl x509 -sha1 -req -in server-req.pem -days 730 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 > server-cert.pem
openssl rsa -in server-key.pem -out server-key.pem
@rogerwalt
rogerwalt / gist:76ddf7057af2ed97580b383e3b66d82c
Created July 14, 2016 12:39
create a self-signed ssl certificate
# openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crt
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
@rogerwalt
rogerwalt / .lftprc
Created December 16, 2013 13:57
Just some lftp configs
set ftp:ssl-allow no
#set ssl:check-hostname false
#set ssl:verify-certificate false
#set ftp:passive-mode on