Skip to content

Instantly share code, notes, and snippets.

@yan-foto
yan-foto / 0-README.txt
Last active Feb 17, 2021
DeDRM Adobe Digital Edition Books
View 0-README.txt
Convenient DeDRM Scripts
-------------------------
**NOTE**: read https://blog.quaintous.com/2021/02/16/remove-drm-from-ebooks/ to find out what this gist is good for.
* ./init.sh: extracts Adobe Digital Editions private key and required files to DeDRM.
* ./dedrm: removes DRM from given ebook (pdf/epub)
If you are using this for the first time, make sure that you have authenticated your Adobe Digital Editions (ADE) and run './init.sh'. Import any DRM-protected file into ADE and run 'dedrm.sh':
@yan-foto
yan-foto / wp-backup.sh
Last active Dec 25, 2020
Migrating managed Wordpress instances to NGINX + PHP-FPM
View wp-backup.sh
#!/bin/bash
set -euo pipefail
err() {
>&2 echo "$1"
exit 1
}
main() {
@yan-foto
yan-foto / git-del-tag.sh
Created Apr 23, 2018
Delete all git tags (remote and local) older than a given date [Linux/MacOS]
View git-del-tag.sh
#!/bin/sh
# Make sure date is given
if [ $# -eq 0 ]
then
printf "Usage:\n bash git-del-tag.sh 2018-04-23"
exit 1
fi
# date command has different syntax for Linux and Mac
@yan-foto
yan-foto / OpenWRT | OpenVPN | PIA - README.md
Last active Jan 5, 2020
OpenWRT configurations to run OpenVPN client | Private Internet Access - https://www.privateinternetaccess.com
View OpenWRT | OpenVPN | PIA - README.md

This gist contains all the OpenWRT configuraion files needed to connect to Private Internet Access (PIA) VPN servers. The following files are included:

  • network: contains configuration to add a virtual network device (i.e. tun1366) and custom DNS servers
  • openvpn: OpenVPN configuration file to connect to PIA VPN servers
  • firewall: firewall configuration which passes all traffic through VPN and rejects any request when OpenVPN is down

NOTE: there are a number of other files required to be available under /etc/openvpn for this approach to work:

  • pia.auth: VPN credentials in two lines, first the username and the second the password
@yan-foto
yan-foto / jenkins.sh
Created Sep 19, 2015
Vagrant shell provision to solve `No X-Jenkins-CLI2-Port` (Ubuntu guest)
View jenkins.sh
#!/bin/bash
# This is a simple example of a shell script which is used as a Vagrant provision
# It can be used as: 'config.vm.provision "shell", path: "./jenkins.sh"'
# inside a Vagrantfile.
# The logic is simple and the implementation as well. Any suggestions/improvements
# are highly welcome.
# Default values
jenkins_home="/var/lib/jenkins"
@yan-foto
yan-foto / logger.js
Last active Aug 29, 2015
Simple JavaScript logger with log level and (graceful) fallback
View logger.js
Logger = function(level) {
this.level = level || 0;
methods = ["trace", "debug", "info", "warn", "error"];
levels = {};
this.log = function() {
(console.log === undefined) ? function() {} : console.log.apply(console, arguments);
};