This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
{- | |
When using `find -type f -print0 | xargs -0 md5sum > foo.sums`, | |
this script allows to compare two files of such sums for their intersecting sums. | |
The `drop 4` later on drops the ' ./' after the md5sums, | |
and the `splitAt 32` determines the length of the sum, | |
in case another sum should be used. | |
Deduplication is performed by replacing the files from f1 | |
with softlinks to files from f2. | |
-} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
SESSION="sessionName" | |
# Creating the tmux session: | |
tmux new-session -d -s $SESSION | |
# Disable renaming of windows: | |
tmux set-option -t $SESSION -g allow-rename off | |
# Function to open a window and connect to a target: | |
# Parameters are window name, target ip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The two backup scripts ``read.sh`` and ``write.sh`` will be executed as a pair, | |
to copy multiple devices or logical volumes from a host to a local computer. | |
To achive this, a number of steps must be taken: | |
1: Fill targets="" with the same sequence of targets for both scripts, the order being essential. | |
2: Make sure the targets to write to at the client/write.sh part are at least as large as the targets on the host/read.sh part. | |
3: We assume that the host runs an ssh server, but the client may not offer an ssh connection. | |
To get data flowing over network from host to client we'll therefore build a reverse tunnel with ssh. | |
```ssh -R 62222:localhost:62222 $host -N``` | |
Note that we use port ``62222`` on both sides, which is the same port as used with ``nc`` in both scripts. | |
4: Start ``write.sh`` before ``read.sh``, so that it already listens for incoming data before ``read.sh`` tries and failes to connect. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# Inspired by https://wiki.archlinux.org/index.php/MAC_address_spoofing | |
eth="eth0" | |
wifi="wlan0" | |
case $1 in | |
old) | |
echo "Changing to your old macs:" | |
macchanger --mac=xx:xx:xx:xx:xx:xx $eth | |
macchanger --mac=xx:xx:xx:xx:xx:xx $wifi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Start/Stop the docker dropbox container | |
After=docker.service | |
[Service] | |
Type=oneshot | |
RemainAfterExit=yes | |
ExecStart=-/usr/bin/make -C <path to docker-dropbox> start | |
ExecStop=-/usr/bin/make -C <path to docker-dropbox> stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Inspired by https://gist.github.com/runjak/1c76dc9e3fcda878c7c9 | |
SESSION="wlan" | |
# Creating a new session: | |
tmux new-session -d -s $SESSION | |
# Splitting the window: | |
tmux split-window -v -t $Session:0.0 | |
tmux split-window -h -t $Session:0.0 | |
# Execute some fun commands: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/sh | |
#https://bitcoin.stackexchange.com/questions/28107/bitcoin-is-not-connected-in-regtest-mode/28109 | |
# Creating config directories: | |
RDIR="/tmp/bitcoind" | |
mkdir -p $RDIR/A $RDIR/B $RDIR/C $RDIR/D $RDIR/E | |
# Starting bitcoind instances: | |
bitcoind -server -listen -port=17591 -rpcuser=bitcoinrpc -rpcpassword=pass -rpcport=16591 -datadir=$RDIR/A/ -connect=localhost:17592 -regtest -pid=$RDIR/A/.pid -daemon -debug | |
bitcoind -server -listen -port=17592 -rpcuser=bitcoinrpc -rpcpassword=pass -rpcport=16592 -datadir=$RDIR/B/ -connect=localhost:17593 -regtest -pid=$RDIR/B/.pid -daemon -debug | |
bitcoind -server -listen -port=17593 -rpcuser=bitcoinrpc -rpcpassword=pass -rpcport=16593 -datadir=$RDIR/C/ -connect=localhost:17594 -regtest -pid=$RDIR/C/.pid -daemon -debug | |
bitcoind -server -listen -port=17594 -rpcuser=bitcoinrpc -rpcpassword=pass -rpcport=16594 -datadir=$RDIR/D/ -connect=localhost:17595 -regtest -pid=$RDIR/D/.pid -daemon -debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
{-| HIM - Join Me In Death |-} | |
txt = [ "Baby join me in death" | |
, "Won't you die" | |
, "this life ain't worth living" | |
, "We are so young" | |
, "our lives have just begun" | |
, "but already we are considering" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Inspired by https://borgbackup.readthedocs.org/en/stable/quickstart.html | |
# https://gist.github.com/ericmieth/c045edebb0709dfd88e1 | |
# Created by mushu 2016-02-22 | |
# Mounting the volume: | |
cryptsetup --key-file <keyFile> luksOpen UUID=<deviceUUID> cryptBackup | |
mount /dev/mapper/cryptBackup /mnt | |
# Verifying current backups: | |
borg check /mnt/backups | |
# Umounting the volume: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DicePuzzle where | |
import Control.Arrow ((&&&)) | |
import Control.Monad | |
import Data.List | |
{-| | |
Projecting the result of three dice onto two dice. | |
After the design of Katie and Paul [1,2,3]. | |
[1]: https://www.youtube.com/watch?v=Hfw8bB82-ps |
OlderNewer