Skip to content

Instantly share code, notes, and snippets.

@rogerwalt
rogerwalt / BitShare_URLextractor.js
Created Jun 11, 2013
Simple one-liner to parse out the URL of the video file on BitShare.
View BitShare_URLextractor.js
window.location.href = document.getElementById("stream_player").innerHTML.split('clip:')[1].split('url:')[1].split("'")[1]
@rogerwalt
rogerwalt / StreamCloud_URLextractor.js
Created Jun 11, 2013
Simple one-liner to parse out the URL of the video file on StreamCloud.
View StreamCloud_URLextractor.js
window.location.href = document.getElementsByName("flashvars")[0].value.split("&file=")[1].split("&")[0].replace(/%3A/g, ":").replace(/%2F/g, "/");
@rogerwalt
rogerwalt / gist:7300568
Created Nov 4, 2013
Windows PowerShell: Create Profile and add Alias to Notepad++ to it.
View gist:7300568
# 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"
View .vimrc
syntax on
"set noexpandtab
"set copyindent
"set preserveindent
"set softtabstop=0
"set shiftwidth=2
"set tabstop=2
set ts=2
set sw=2
set foldmethod=indent
@rogerwalt
rogerwalt / gist:7823511
Created Dec 6, 2013
Make Caps-Lock another Esc-Key
View gist:7823511
# ~/.Xmodmap
!! No Caps Lock
clear lock
!! Make Caps_lock an escape key.
keycode 0x42 = Escape
# $ xmodmap ~/.Xmodmap
@rogerwalt
rogerwalt / .lftprc
Created Dec 16, 2013
Just some lftp configs
View .lftprc
set ftp:ssl-allow no
#set ssl:check-hostname false
#set ssl:verify-certificate false
#set ftp:passive-mode on
@rogerwalt
rogerwalt / gist:76ddf7057af2ed97580b383e3b66d82c
Created Jul 14, 2016
create a self-signed ssl certificate
View gist:76ddf7057af2ed97580b383e3b66d82c
# 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;
View gist:749e7663e840eadb638777c052ac488e
# 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 / interactiveRebase.md
Created Jan 30, 2017
Interactive rebase merge
View interactiveRebase.md

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 / promise.test.js
Last active Feb 6, 2018
How to jest promises
View promise.test.js
/**
* 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);