Skip to content

Instantly share code, notes, and snippets.

View mschaaf's full-sized avatar

Schaaf, Martin mschaaf

View GitHub Profile
@mschaaf
mschaaf / gist:1151473
Created August 17, 2011 12:51
Shell script spinner in two different lines.
while [ '1' == '1' ]
do
echo -n -e "\rA B| C\nD| E F";
echo -n -e "\033[1A";
echo -n -e "\rA B/ C\nD/ E F";
echo -n -e "\033[1A";
echo -n -e "\rA B- C\nD- E F";
echo -n -e "\033[1A";
echo -n -e "\rA B\\ C\nD\\ E F";
echo -n -e "\033[1A";
@mschaaf
mschaaf / regexp: parsing out first host from a string
Created January 22, 2013 22:49
parses out host from the follwing strings: "d protocol://a:b@host", "d protocol://a:b@host/", "d protocol://a:b@host?", "d protocol://a:b@host dfgdg", "d protocol://host", "d protocol://host/", "d protocol://host?", "d protocol://host fdgdg"
[^:]+\s?\w://(.+@){0,1}([^/ ?]*)
@mschaaf
mschaaf / gist:6725177
Created September 27, 2013 07:20
html encode/decode with javascript and jquery
function decodeHtml(value) {
if (value) {
return $('<div/>').html(value).text();
}
return value;
}
function encodeHtml(value) {
if (value) {
return $('<div/>').text(value).html();
@mschaaf
mschaaf / sync-notes.sh
Created March 29, 2020 18:13
joplin sync notes
#!/bin/sh
#export SSH_AUTH_SOCK=/run/user/$EUID/keyring/.ssh
#export SSH_AGENT_PID=$(pgrep -nu $USER ssh-agent)
$HOME/.nvm/versions/node/v10.15.3/bin/node $HOME/.nvm/versions/node/v10.15.3/bin/joplin sync > /dev/null
cd ~/workspace.private/joplin_storage # <- path to joplin note repository
git add . && git commit --no-gpg-sign -m "sync notes from $(hostname)" > /dev/null