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 | |
### config ### | |
user_home=/home/user | |
log_dir=$user_home/restic_logs | |
script_dir=`cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P` | |
tiers="1" | |
backup_dirs_1="/mnt/data/media $user_home /mnt/data2 /var/lib/docker/volumes /home/borg/matrix" | |
# backup_dirs_2="" |
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
#!/opt/homebrew/bin/python3 | |
import subprocess | |
curpkg = '' | |
count = 0 | |
pkgs = {} | |
for pkg in subprocess.check_output('brew deps --tree --installed', shell=True).decode('utf-8').split('\n'): | |
pkg = pkg.strip() | |
if len(pkg) > 0 and pkg[0].isalnum(): | |
curpkg = pkg |
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
package sparse_gogo | |
import ( | |
"fmt" | |
"strconv" | |
"testing" | |
) | |
const MIN_SIZE = 4 | |
const MAX_SIZE = 20 |
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
package sparse_gogo | |
import ( | |
"fmt" | |
"testing" | |
) | |
func BenchmarkMapCreate(b *testing.B) { | |
for i := 0; i < b.N; i++ { | |
m := map[int]string{ |
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 | |
while true; do | |
cur_second=`date +"%-S"` | |
if (( $cur_second == 0 )); then | |
minute=$cur_minute | |
echo -n $'\n'`date +"%d.%m.%y %H:%M"`: | |
elif (( $cur_second % 10 == 0 )); then | |
echo -n ' |' | |
fi |
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/env bash | |
ROOTCERT=root.crt | |
ROOTKEY=root.key | |
ROOTDAYS=2000 | |
CERTDAYS=500 | |
if [[ ! -f $ROOTKEY ]]; then | |
read -e -p "Root CA Organization name: " -i "PersonalRootCA" rootorgname | |
openssl genrsa -out $ROOTKEY 4096 && |
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 | |
sudo apt install -y htop mc fail2ban python3-pip | |
sudo pip3 install thefuck |
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 sys, re | |
fileName = sys.argv[1] | |
with open(fileName, 'r', encoding='utf-8') as f: | |
firstSection = '' | |
currentFile = None | |
for line in f: | |
if line.startswith('CREATE DATABASE'): | |
if currentFile: | |
currentFile.close() |