Skip to content

Instantly share code, notes, and snippets.

View moisespsena's full-sized avatar

Moises P. Sena moisespsena

View GitHub Profile
@moisespsena
moisespsena / pdf-unlocker.sh
Created August 21, 2014 03:32
Unlock PDF file with ghostscript
#!/bin/bash
# usage: pdf-unlock.sh locked.pdf > unlocked
# more info: http://superuser.com/questions/367184/pdf-removing-usage-restrictions
which ghostscript >/dev/null || {
echo "ERROR: install 'ghostscript' package using 'sudo apt-get install ghostscript' command >&2"
}
gs -sPDFPassword=$PASS -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=%stdout% -c .setpdfwrite -f "$@"
@moisespsena
moisespsena / base36.py
Created July 23, 2014 01:40
Python Base 36 encode and decode
#!/usr/bin/env python
'''
Python Base 36 encode and decode
'''
__author__ = 'Moises P Sena <moisespsena@gmail.com>'
__version__ = 0.1
CHARS = ''.join(map(str, range(10))) + 'abcdefghijklmnopqrstuvwxyz'
L_CHARS = len(CHARS)
@moisespsena
moisespsena / bible_com_versions_id.js
Created May 28, 2014 12:28
Generate one list with version identification, version abbreviation and version name of versions and print it to console, in http://bible.com/bible
var data = [];
jQuery("#menu_version .scroll TR").each(function() {
var l = $(this);
if (!l.attr('data-abbrev')) {
return;
}
data[data.length] = [
l.attr('data-version'),
l.attr('data-abbrev'),
l.attr('data-meta')
@moisespsena
moisespsena / bible_com_num_chapters.js
Last active August 29, 2015 14:01
Generate one list with name of book, the book identification and number of chapters and print it to console, in http://bible.com/bible
var data = [];
jQuery("#menu_book UL LI A").each(function() {
var l = $(this);
l.click();
data[data.length] = [
l.text().replace(/(^\s+|\s+$)/g, ''),
l.attr('data-book'),
$("#chapter_selector LI:last").text().replace(/(^\s+|\s+$)/g, '')
]
});