This file contains hidden or 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 | |
# Run a number of commands within tmux in a grid layout | |
# Session name | |
s=exp | |
# Command | |
c="for i in {1..10}; do echo -n .; sleep 1; done; read" | |
if tmux has-session -t $s 2>/dev/null; then | |
echo "Session '$s' exists already, bailing out!" |
This file contains hidden or 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
import torch | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy.stats import wasserstein_distance | |
from emd import EMDLoss | |
def gaussian(x, mu, sig): | |
return np.exp(-np.power(x - mu, 2.) / (2 * np.power(sig, 2.))) |
This file contains hidden or 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
import requests | |
import os | |
import pandas as pd | |
import seaborn as sns | |
import matplotlib.pyplot as plt | |
BASE_URL = 'https://seatfinder.bibliothek.kit.edu/kassel/getdata.php?location%5B0%5D=UBA0EP,UBA1EP,UBA2EP,UBA3EP,UBB0EP,UBB0GP,UBB1EP,UBB1GP,UBB2EP,UBB2GP,LeoEG,LeoOG&values%5B0%5D=manualcount,seatestimate&after%5B0%5D=-1year&before%5B0%5D=now' | |
DELIMITER = ';' | |
FILE_MANUAL_COUNT = 'seatfinder_manual_count.csv' |
This file contains hidden or 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 | |
# When the power supply is disconnected, shut down machine after a defined time | |
# and warning messages | |
# Time in seconds to shutdown device after disconnected power supply | |
grace_time=500 | |
timeout=0 | |
while :; do | |
state=$(upower -i "$battery" | grep state | awk '{print $2}') |
This file contains hidden or 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 | |
# Pings a list of hosts and send a Wake On LAN request on success | |
wake_mac='e8:9a:8f:fd:e6:ce' | |
declare -a ping_hosts=(\ | |
192.168.3.36 \ # flipdot display | |
guest.fd \ | |
drinks-touch.fd \ | |
drinks.fd \ | |
) |
This file contains hidden or 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 | |
# Count users currently logged into a list of Freifunk Kassel nodes | |
url_base=https://graphite.freifunk-kassel.de | |
url_params="rawData=true" | |
time_offset="5min" | |
node_pre="ffks.nodes." | |
node_post=".clients" |
This file contains hidden or 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/env python3 | |
import socket | |
import sys | |
from PIL import Image | |
host = '192.168.3.36'; | |
port = 2323; | |
w = 48 |
This file contains hidden or 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 | |
# Extracts a partition from a full disk image containing a partition table | |
# Colors | |
red='\033[0;31m' | |
green='\033[0;32m' | |
yellow='\033[0;33m' | |
cyan='\033[0;36m' | |
nc='\033[0m' # no color |
This file contains hidden or 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 | |
for f in $(ls -tr1 "$1"); do | |
d="$(stat -c%y $f | awk '{print $1}')T00:00:00" | |
echo $d $f | |
git add $f | |
GIT_COMMITER_DATE="$d" GIT_AUTHOR_DATE="$d" git commit -m "Add $f" | |
echo | |
done |
This file contains hidden or 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 | |
grn='\e[0;32m' | |
red='\e[0;31m' | |
clr='\e[0m' | |
for f in $1/*; do | |
fn=$(basename $f) | |
# file system time stamp | |
fsts=$(stat -c%y $f | awk '{print $1}') | |
# key file time stamp |