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 | |
from tlds import tld_set | |
for tld in tld_set: | |
try: | |
requests.get(f"https://{tld}") | |
except requests.exceptions.RequestException: | |
print(f"Failed to connect to {tld}") | |
else: | |
print(f"{tld} works!") |
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
============================= test session starts ============================== | |
platform linux2 -- Python 2.7.12, pytest-3.1.2, py-1.4.34, pluggy-0.4.0 | |
rootdir: /tmp/test, inifile: | |
collected 1 items | |
unicode_helper.py F | |
=================================== FAILURES =================================== | |
___________________ [doctest] unicode_helper.fix_bad_unicode ___________________ |
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 | |
SOURCE_DIR=/home/niklas/ | |
TARGET_DIR=/media/Backup/FileBackup | |
EXCLUDE_FILE=/home/niklas/rsync_excludelist | |
rsync -avP --exclude-from=${EXCLUDE_FILE} --delete-excluded --delete --stats ${SOURCE_DIR} ${TARGET_DIR} | |
# add log entry to target dir | |
LOGFILE="$TARGET_DIR/backup_log" | |
DATE=$(date) | |
echo "Last backup on $DATE" >> $LOGFILE |
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 | |
DATE=$(date +%d.%m.%y-%H.%M) | |
# the unencrypted tar file | |
FILE=${DATE}Uhr.tar.gz | |
tar -czf ${FILE} -T .files_to_archive | |
# the encrypted tar file | |
ENCFILE=${FILE}.crypt | |
gpg -c -o ${ENCFILE} ${FILE} | |
# move encrypted archive to Dropbox | |
mv ${ENCFILE} Dropbox/backups |
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/bash | |
xdotool mousemove 200 400 | |
while true | |
do | |
xdotool click 1 & | |
eval $(xdotool getmouselocation --shell 2>/dev/null) | |
if [ "$X" -ne "200" ] | |
then | |
break | |
fi |