Skip to content

Instantly share code, notes, and snippets.

View lauriro's full-sized avatar

Lauri Rooden lauriro

View GitHub Profile
@lauriro
lauriro / heredoc
Last active September 11, 2021 16:05
#!/bin/sh
# Usage info
show_help1() {
cat << EOF
Usage: ${0##*/} [-hv] [-f OUTFILE] [FILE]...
Do stuff with FILE and write the result to standard output. With no FILE
or when FILE is -, read standard input.
-h display this help and exit
-f OUTFILE write the result to OUTFILE instead of standard output.
@lauriro
lauriro / diff.mdown
Created February 23, 2021 15:55 — forked from ndarville/diff.mdown
Paul Heckel's Diff Algorithm

[Isolating Differences Between Files][paper]

Advantage over Other Algorithms

The diff output is more specific:

[I]f a whole block of text is moved, then all of it, rather than just the beginning and end, is detected as changed.

>The algorithm described here avoids these difficulties. It detects differences that correspond very closely to our intuitive notion of difference.

@lauriro
lauriro / Readme.md
Last active February 6, 2018 08:39
bench

Hello

@lauriro
lauriro / time_to_run.sh
Last active December 23, 2015 18:19
Show command execution time in shell when it takes more than five seconds.
# Add to .bashrc or .zshrc and try it out
# $ sleep 5
# -- Runs 5 seconds
time_to_words() {
local mod num="$1" out=""
set -- 60 second 60 minute 24 hour 7 day 4 week 12 month
while test $num -gt 0; do
mod=`expr $num % $1`
export PS1='\n\[\e[32m\]\t \u@\h \[\e[33m\w$(__git_ps1)\e[0m\]\n\$ '
ps1_time() {
local s=1 c IFS=$'\n'
for c in $BASH_COMMAND; do s=$((${#c}/$COLUMNS+1+$s)); done
printf "\033[s\033[${s}A\033[32m%s\033[0m\033[u" $(date +%H:%M:%S);
}
export PROMPT_COMMAND="trap 'ps1_time; trap DEBUG' DEBUG"
@lauriro
lauriro / gist:944278
Created April 27, 2011 13:49
krüptitud data
Lauri@Lauri-PC ~/.ssh (acer *)
$ echo "123" | openssl rsautl -inkey ~/.ssh/id_rsa.pub.pem -pubin -encrypt | openssl base64
GC5YemYYXLkkd8FulzLvJyKrtnqtxP0FuZ27qhDMgA1i38pi4Lgs/xFLwOYa1Hcu
TDuVETicqnBRCg0erBqmJwnCLe8qLvOio+MpnUO01LZzMC8XM0X7A6iSL4TtEUqw
fzD+ZqpHhGHlZHNhQ3U8nl2ZpiFTPr5ho9FRG8f6e9mJrI0n4xnNB3xKj9S9k00P
Njqn753WNRE5KC+8vwo8zrjgmB3is1Q0kIdmlTGzJfq8N08MQDJT1gAV/hsbCjvV
dqd7QNvInrq3qCA5H0aHhFV+EhXU8OxSKPYVnhslm6j6KDjZij0Idv7vEuDIlJsK
MngVoDaSpjy7abfyLTvA+NAqIMGAr98Tp3ik+2xAcyKpM/b4SVWvWEJalVXbV72S
8HK2FVK2IlaULto0qpGHOl/QqPzLuIpmVB3zzU8VyPBAUWuvuJUpoFGIvslItrTe
vyHs93c3qmcEgNHJQPPTufHp1/JYtZ00odGGDRCcbU34Fg782hXMKqRuCmOGrjEQ
@lauriro
lauriro / rsacrypt.sh
Created August 26, 2010 21:22
RSA Encryption
#!/bin/sh
# openssl rsa -in ~/.ssh/id_rsa -pubout -out ~/.ssh/id_rsa.pub.pem
# ln -s ~/rsacrypt.sh /usr/bin/rsacrypt
ENCRYPTED=""
DECRYPTED=""
usage() {
echo -e "\nUsage: $0 [-e [PUBLIC_KEY]] [-d [PRIVATE_KEY]]"
exit 1
http://github.com/medined/smime
Secure Exchange Solutions
SES Client
The tool it is mostly about an AS1 implementation (www.ietf.org, look for
"MIME-based secure EDI"). The end-user tool should be able to download from
an Internet site (there is a specific WSDL, authentication mechanism and file
format) a directory of contacts (name and e-mail plus the public encryption
@lauriro
lauriro / Makefile
Created July 16, 2010 08:12
Makefile
#
# Makefile for Project
#
#
# Tags:
# =====
#
# Certain tags are used in comments to assist in indexing common issues:
# - TODO to indicate planned enhancements.
# - FIXME to mark potential problematic code that requires special
@lauriro
lauriro / diffmerge-merge.sh
Created March 4, 2010 14:02
diffmerge-merge.sh
#!/bin/sh
localPath="$(cygpath --mixed --absolute "$2")"
basePath="$(cygpath --mixed --absolute "$1")"
remotePath="$(cygpath --mixed --absolute "$3")"
resultPath="$(cygpath --mixed --absolute "$4")"
if [ ! -f $basePath ]
then
basePath="$(cygpath --mixed --absolute ~/diffmerge-empty)"