Skip to content

Instantly share code, notes, and snippets.

Avatar

Raphi raphiz

View GitHub Profile
@raphiz
raphiz / pdf_remove_watermark.py
Created Sep 28, 2015
PDF watermark removal
View pdf_remove_watermark.py
from PyPDF2 import PdfFileReader, PdfFileWriter
from PyPDF2.pdf import ContentStream
from PyPDF2.generic import TextStringObject, NameObject
from PyPDF2.utils import b_
wm_text = 'Persönliches Exemplar von'
replace_with = ''
# Load PDF into pyPDF
source = PdfFileReader(open('input.pdf', "rb"))
@raphiz
raphiz / deploy.sh
Last active Aug 29, 2015
FTP Deplozment Script
View deploy.sh
#!/usr/bin/env bash
# Abort if a command fails!
set -e
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
if [ ! -n "$HOST" ];then
echo "missing option \"HOST\", aborting"
exit 1
@raphiz
raphiz / nsupdate.sh
Last active Feb 2, 2020
Update script for nsupdate.info (For Synology NAS systems)
View nsupdate.sh
#!/usr/bin/env sh
DOMAIN="domain.nsupdate.info"
TOKEN="MYTOKEN"
# Evaluate the current remote IP and the one that is currently registerd
CURRENT=$(curl -s https://ipv4.nsupdate.info/myip)
SAVED=$(python2 -c "import socket; print socket.gethostbyname('$DOMAIN')")
LOGFILE=$( cd "$( dirname "${0}" )" && pwd )/log.txt
TEMPFILE=$( cd "$( dirname "${0}" )" && pwd )/tmp
@raphiz
raphiz / deploy.sh
Created Dec 28, 2014
Easily deploy Composer Apps to a remote FTP server using curlftpfs, rsync and git
View deploy.sh
#!/usr/bin/env bash
# Requires: fuse, curlftpfs, rsync, git and composer
set -u
REPOSITORY="https://github.com/raphiz/php-raphael.li.git"
FTP_HOST="myhost.com"
FTP_USER="user"
FTP_PASS="secrit"
FTP_SUBFOLDER="httpdocs"
@raphiz
raphiz / android-backup-extractor.sh
Created Dec 28, 2014
Converts the contents of a .ab android backup file into a .tar archive
View android-backup-extractor.sh
#!/usr/bin/env bash
#
# Converts the contents of a .ab android backup file into a .tar archive
#
# Usage: android-backup-extractor.sh SOURCE <DESTINATION>
#
# Requirements: dd, openssl
# License: MIT
# Autor: Raphael Zimmermann (http://raphael.li)
#
@raphiz
raphiz / synchronize_ftp.sh
Created Nov 12, 2014
Synchronize FTP server with a local directory (Linux)
View synchronize_ftp.sh
#!/usr/bin/env bash
# Requires: curlftpfs, unison and fuse.
# Configuration:
MOUNTPOINT=/mnt/my_ftp_share/
LOCAL="/home/user/directory"
FTP_HOST="example.com"
FTP_USER="user"
FTP_PASS="secrit"
You can’t perform that action at this time.