Skip to content

Instantly share code, notes, and snippets.

@lstor
lstor / motd.sh
Last active Jan 12, 2018
Colorful motd with hostname and last logins
View motd.sh
# Make sure to install 'figlet' and 'lolcat' and
# update their path in the script as necessary
if [ -z "$TMUX" ]; then
{
echo -e "\nWelcome to..."
/usr/bin/figlet -f slant " `/bin/hostname -s`"
echo "List of last logins: "
/usr/bin/last | head -n 5
} | /usr/games/lolcat
fi
@lstor
lstor / install_dotfiles.sh
Last active Apr 3, 2016
Install dotfiles
View install_dotfiles.sh
echo "Installing dotfiles..."
# Clone repo
git clone --bare --separate-git-dir=$HOME/.dotfiles https://github.com/lstor/dotfiles $HOME/dotfiles-unused
# Move submodules, if any
if [ -x ~/dotfiles-tmp/.gitmodules ]; do
cp -v ~/dotfiles-tmp/.gitmodules ~
fi
View keybase.md

Keybase proof

I hereby claim:

  • I am lstor on github.
  • I am lstor (https://keybase.io/lstor) on keybase.
  • I have a public key whose fingerprint is 16EE AB66 8F0B 7D35 3ED0 5F10 9A79 7B22 29EB 2FB1

To claim this, I am signing this object:

@lstor
lstor / Crypto.exs
Created Apr 15, 2015
Compute MD5 hash
View Crypto.exs
defmodule Crypto do
def md5(data) do
:erlang.md5(data)
|> :erlang.bitstring_to_list
|> Enum.map(&(:io_lib.format("~2.16.0b", [&1])))
|> List.flatten
|> :erlang.list_to_bitstring
end
end
View gist:81b9e3183bdec21743dc
<?xml version="1.0"?>
<settings>
<console change_refresh="10" refresh="100" rows="25" columns="80" buffer_rows="500" buffer_columns="0" shell="C:\Program Files (x86)\Git\bin\sh.exe --login -i" init_dir="C:\src" start_hidden="0" save_size="0" background_text_opacity="255">
<colors background_text_opacity="255">
<color id="0" r="0" g="0" b="0"/>
<color id="1" r="0" g="0" b="128"/>
<color id="2" r="0" g="150" b="0"/>
<color id="3" r="0" g="150" b="150"/>
<color id="4" r="170" g="25" b="25"/>
<color id="5" r="128" g="0" b="128"/>
View In a diff, search for added lines containing 'bacon', and highlight only 'bacon'
/^+[^+].*\zsbacon
; Explanation:
; / <- start search
; ^+ <- has a + at the beginning of the line
; [^+] <- does not have another + after that (avoid +++-lines)
; .* <- match anything up until...
; \zs <- start highlighted area (match)
; bacon <- what we're actually looking for