Skip to content

Instantly share code, notes, and snippets.

View NiklasMM's full-sized avatar

Niklas NiklasMM

View GitHub Profile
@NiklasMM
NiklasMM / tld.py
Created February 19, 2020 14:45
Check for websites directly hosted on tld
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!")
============================= 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 ___________________
@NiklasMM
NiklasMM / backup.sh
Last active December 26, 2015 07:29
One line file backup script
#!/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
@NiklasMM
NiklasMM / dropbox_backup.sh
Last active December 26, 2015 07:28
A script I use to store encrypted backups of my files on dropbox
#!/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
@NiklasMM
NiklasMM / clicker.sh
Created October 4, 2013 13:28
Coockie clicker cheat script....
#! /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