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 | |
cmd="$1" | |
get_api_key() { | |
keyfile="manage_syncthing_api_key" | |
if ! [ -e ~/.config/"$keyfile" ] || [ -z "$(cat ~/.config/"$keyfile")" ]; then | |
echo "Get the API key from syncthing, and then paste it below" | |
read -p "Enter API Key: " API_KEY | |
echo "$API_KEY" > ~/.config/"$keyfile" |
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 | |
INCLUDE= | |
EXCLUDE= | |
COUNT= | |
while getopts ":i:e:m:ch" flag; do | |
case $flag in | |
i|include) INCLUDE="$OPTARG";; | |
e|exclude) EXCLUDE="$OPTARG";; | |
c|count) COUNT=1;; |
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
SELECT (pg_stat_file('base/'||oid ||'/PG_VERSION')).modification, datname FROM pg_database; |
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
SELECT blocks.pid, | |
(select query from pg_stat_activity where pid = blocks.pid) as blocked_query, | |
blocks.blocking_pid, | |
(select query from pg_stat_activity where pid = blocks.blocking_pid) AS blocking_query | |
FROM ( | |
SELECT pid, unnest(pg_blocking_pids(pid)) AS blocking_pid | |
FROM pg_locks | |
WHERE granted = false | |
) AS blocks; |
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/python | |
""" | |
Run this script twice: | |
1) Run it with the 'search' flag, and an output csv file. | |
- Then edit the csv file, and update the final column. The found date is | |
used as a reference | |
If you want to skip a file, don't include it. | |
The date should be in the format; | |
%Y:%m:%d %H:%M:%S |
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/python3 | |
""" | |
Update the LONG_SIZE and SHORT_SIZE | |
then provide a folder to scan (scan_folder) | |
and a folder to write new files (output_folder) | |
""" | |
import glob | |
import os | |
import subprocess |
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 | |
compare_files() { | |
file="$1" | |
original="$2" | |
case "$(file "$original")" in | |
*JPEG*|*PNG*) | |
identify "$file" | |
identify "$original" | |
if sudo -Hu "$USER" xdpyinfo -display "$DISPLAY" > /dev/null 2>&1; then | |
gthumb "$file" "$original" |
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
CREATE DATABASE matomo_db_name_here; | |
CREATE USER 'matomo'@'localhost' IDENTIFIED BY 'my-strong-password-here'; | |
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, INDEX, DROP, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON matomo_db_name_here.* TO 'matomo'@'localhost'; | |
flush privileges; |
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 | |
WORDFILE="/usr/share/dict/words" | |
NUMWORDS=10 | |
#Number of lines in $WORDFILE | |
tL=`awk 'NF!=0 {++c} END {print c}' $WORDFILE` | |
for i in `seq $NUMWORDS`; do | |
rnum=$((RANDOM%$tL+1)); | |
sed -n "$rnum p" $WORDFILE; |
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
select pid, now() - query_start, query | |
from pg_stat_activity | |
where state = 'active' and now() - query_start > '5min'; |
NewerOlder