Skip to content

Instantly share code, notes, and snippets.

View moisespsena's full-sized avatar

Moises P. Sena moisespsena

View GitHub Profile
@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, '')
]
});
@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 / 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 / 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 / SimpleHttpClient.py
Last active March 9, 2021 00:32
Python Simple HTTP Client
#!/usr/bin/env python
'''
SimpleHttpClient: Python Simple HTTP Client
Author: Moises P. Sena <moisespsena AT gmail.com>
CONNECT AND CLOSE:
>>> host, port = 'localhost', 80
>>> c = SimpleHttpClient((host, port), host)
@moisespsena
moisespsena / julia-env.sh
Last active May 13, 2017 01:23
Install Latest Julia Stable enviroment on Debian
#!/bin/bash
SD=$(dirname $(realpath "$0")) || exit 1
[ `arch` = 'x86_64' ] && url='https://julialang.s3.amazonaws.com/bin/linux/x64/0.4/julia-0.4.2-linux-x86_64.tar.gz' \
|| url='https://julialang.s3.amazonaws.com/bin/linux/x86/0.4/julia-0.4.2-linux-i686.tar.gz'
echo $url
tmpd="$SD/tmp"
@moisespsena
moisespsena / copy-linux.sh
Last active November 17, 2022 11:10
Copy the Linux System to another partition
#!/bin/bash
#
# For partition only, set PARTITION_ONLY=1 enviroment variable
#
VERSION=1
PARTITION_ONLY=$PARTITION_ONLY
function _continue_or_cancel() {
echo digite \'YeS\' para CONTINUAR, caso contrario sera cancelado:
@moisespsena
moisespsena / github-origin2ssh
Last active September 19, 2018 21:22
Convert HTTPS github origin url to SSH in GOPATH
#!/bin/bash
if [ "$1" != '' ]; then
cd "$1" || exit $?
fi
find `pwd` -name .git -type d | while read l; do
perl -i -pe 's/https:\/\/github.com\/([^\/]+)\/(.+?)(\.git)?$/git\@github.com:\1\/\2.git/' "$l/config" && dirname "$l"
done
@moisespsena
moisespsena / git-r-state
Last active August 30, 2018 14:43
Show GIT repositories state recursively
#!/bin/bash
# Show GIT repositories state recursively
if [ "$1" != '' ]; then
cd "$1" || exit $?
fi
find `pwd` -name .git -type d | while read l; do
p=`dirname "$l"`
cd "$p"
sc=0

Keybase proof

I hereby claim:

  • I am moisespsena on github.
  • I am moisespsena (https://keybase.io/moisespsena) on keybase.
  • I have a public key ASAdvzvnonT0YEhBtxZSk8iHH2UlWPPZT_X0Oqd7Va0MzQo

To claim this, I am signing this object: