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
GIT_REMOTE=origin | |
help: | |
@echo Use any of the following targets: | |
@grep '^[a-z]' Makefile | cut -d : -f 1 | |
_submit: | |
# Argument ASS needs to be set for this target! | |
n=$(shell git tag -l | grep ${ASS} | cut -d '-' -f 2 | sort -n | tail -n 1) ;\ | |
[ -z "$$n" ] && n=0 ;\ |
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
# have an intermediate _help, to move the actual help target to the file end | |
_help: help | |
#= Section 1 | |
target1: | |
echo target1 | |
target2: target1 | |
echo target2 |
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
# probably want to start a new session, so the key is removed once the script closes | |
keyctl new_session >/dev/null | |
# read tye key into keyctl | |
stty -echo | |
echo -n "Enter ssh password: " | |
password_key=$(read -s password && echo -n "$password" | keyctl padd user pw @s) | |
stty echo | |
echo "" |
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
snakes = { | |
17: 7, | |
54: 34, | |
62: 19, | |
64: 60, | |
87: 24, | |
93: 73, | |
95: 75, | |
99: 78, | |
} |
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/python3 | |
import timeit | |
from time import process_time_ns | |
def gen(n, rec): | |
if rec > 0: | |
yield from gen(n, rec-1) | |
else: | |
for i in range(n): |
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/python3 | |
from datetime import datetime, timedelta | |
import numpy as np | |
import timeit | |
np.set_printoptions(linewidth=np.inf, formatter={'float': lambda x: format(x, '1.5E')}) | |
def indexed(arr, indices, num_indices, accesses): | |
s = 0 |
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
import logging | |
LOG = logging.getLogger(__name__) | |
logging.basicConfig(format="[%(levelname)8s] %(message)s (%(funcName)s@%(filename)s:%(lineno)s)") | |
LOG.setLevel(logging.DEBUG) | |
LOGLEVEL_FUNCS = {} # autoreload workaround https://github.com/ipython/ipython/issues/11099#issuecomment-382029692 | |
def loglevel(level): | |
def outer(func): | |
LOG.debug(f"loglevel {level} for function {func.__qualname__}") |
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
FROM debian:10-slim | |
RUN apt-get update \ | |
&& apt-get upgrade -y \ | |
&& echo "deb http://deb.debian.org/debian testing non-free contrib main" >> /etc/apt/sources.list \ | |
&& apt-get update \ | |
&& apt-get install -y --no-install-recommends libcrypt1 \ | |
&& apt-get install -y --no-install-recommends libc6 \ | |
&& apt-get upgrade -y \ | |
&& apt-get install -y --no-install-recommends \ |
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
# Resources this configurations is inspired by | |
# https://techrapiduk.blogspot.com/2017/04/send-email-on-raspberry-pi-with-msmtp.html | |
# https://www.raspberrypi.org/forums/viewtopic.php?t=244147 | |
# Fix log permissions | |
# https://askubuntu.com/a/1269230/776650 | |
account default | |
host smtp.gmail.com | |
port 465 |
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 | |
USERNAME=user | |
SSH_CMD="ssh user@domain -i /home/user/.ssh/no_pw" | |
MAX_TRIES=4 | |
RESTART_DELAY=`expr 15 \* 60` # seconds | |
tmpfile=/tmp/restart_unless_ssh-`date +%s` | |
lock=/tmp/restart_unless_ssh-lock |
NewerOlder