Skip to content

Instantly share code, notes, and snippets.

View yan-foto's full-sized avatar
010101

Yan Foto yan-foto

010101
View GitHub Profile
@yan-foto
yan-foto / logger.js
Last active August 29, 2015 14:25
Simple JavaScript logger with log level and (graceful) fallback
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);
};
@yan-foto
yan-foto / jenkins.sh
Created September 19, 2015 13:17
Vagrant shell provision to solve `No X-Jenkins-CLI2-Port` (Ubuntu guest)
#!/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 / OpenWRT | OpenVPN | PIA - README.md
Last active January 5, 2020 22:25
OpenWRT configurations to run OpenVPN client | Private Internet Access - https://www.privateinternetaccess.com

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 / git-del-tag.sh
Created April 23, 2018 13:50
Delete all git tags (remote and local) older than a given date [Linux/MacOS]
#!/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 / wp-backup.sh
Last active December 25, 2020 21:01
Migrating managed Wordpress instances to NGINX + PHP-FPM
#!/bin/bash
set -euo pipefail
err() {
>&2 echo "$1"
exit 1
}
main() {
@yan-foto
yan-foto / 0-README.txt
Last active January 27, 2024 18:48
DeDRM Adobe Digital Edition Books
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':