Skip to content

Instantly share code, notes, and snippets.

View mauricioprado00's full-sized avatar
🏠
Working from home

mauricioprado00

🏠
Working from home
View GitHub Profile
@mauricioprado00
mauricioprado00 / decrypt
Last active January 25, 2019 22:27
openssl
# curl -L https://bit.ly/2RiJ3j0 | bash -s 1.0.2g myfile.enc myfile
# available versions: https://cloud.docker.com/u/mauricioprado00/repository/docker/mauricioprado00/openssl
# 1.0.2g
# 1.1.0g
version=${1}
input=${2:-.}
output=${3:-.}
docker run --rm -ti \
# build docker images for all openssl "old" versions
# download all versions
x_subversions=$(curl https://www.openssl.org/source/old/ | egrep -A20 'entry-content' | grep '<li>' | awk -F '"' '{print $2}')
for x_subversion in $x_subversions; do
echo retrieving subversions $x_subversion
# x_subversion=1.0.2
x_versions=$(curl https://www.openssl.org/source/old/${x_subversion}/ | grep tar.gz | awk -F '"' '{print $2}')
for x_version in $x_versions; do
ifconfig eth0 | grep -v inet6 | grep inet | awk '{ print $2 }' | sed 's#addr:##g'
@mauricioprado00
mauricioprado00 / show-from-source
Created July 19, 2017 13:23
show from source for phpstorm in ubuntu
#!/usr/bin/env bash
# requires: imagemagik, xdotool, xwininfo
window_id=$(xwininfo -tree -root | grep 'PhpStorm 2016.2.2' | awk '{print $1}')
window_x=$(xwininfo -id $window_id | grep 'Absolute upper-left X' | awk '{print $NF}')
window_y=$(xwininfo -id $window_id | grep 'Absolute upper-left Y' | awk '{print $NF}')
import -window $window_id /tmp/screenshot.jpg
convert -crop 250x40+200+45 /tmp/screenshot.jpg /tmp/toolbar.jpg
position=$(compare -metric RMSE -subimage-search /tmp/toolbar.jpg ~/show-from-source.jpg similarity.jpg 2>&1 | awk '{print $NF}')
@mauricioprado00
mauricioprado00 / web-servers.md
Created January 5, 2018 13:54 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@mauricioprado00
mauricioprado00 / debian-package.sh
Last active November 4, 2017 16:06
pull debian package (or ubuntu, or whatever)
# obtains debian packages
# Examples:
# gimp on current directory from debian 6
# curl -L https://goo.gl/jruRgy | bash -s gimp
# gimp on directory gimp-install-dir
# curl -L https://goo.gl/jruRgy | bash -s gimp gimp-install-dir
# only partial package of gimp (/usr/bin)
@mauricioprado00
mauricioprado00 / alpine-chroot.sh
Last active November 3, 2017 17:49
alpine-chroot
# for more info https://wiki.alpinelinux.org/wiki/Installing_Alpine_Linux_in_a_chroot
# one-liner:
# curl -L https://goo.gl/huUs7L | bash
# one liner with params:
# curl -L https://goo.gl/huUs7L | bash -s myalpinedir x86_64 v3.4
# one liner from yandex:
# curl -L https://goo.gl/huUs7L | MIRROR_FILTER=yandex bash -s myalpinedir x86_64 v3.4
# get a random mirror from the available list
this_gist='https://gist.githubusercontent.com/mauricioprado00/1e40021b7e5a8bfdc8049e51b851d4b9/raw/'
@mauricioprado00
mauricioprado00 / create-openvpn-server.sh
Created November 2, 2017 23:00
create openvpn server
# a fully automated script to configure an openvpn server and create the config for one user
# tested only on ubuntu
# Configurar un Servidor OpenVPN en Ubuntu 16.04
# from https://www.digitalocean.com/community/tutorials/como-configurar-un-servidor-openvpn-en-ubuntu-16-04-es
server_name="NY-DO"
client_1=mauricio
port=443
server_ip=$(dig +short myip.opendns.com @resolver1.opendns.com)
@mauricioprado00
mauricioprado00 / apache-chrooted.sh
Last active November 1, 2017 15:52
apache chrooted debian
# requires (on ubuntu: apt-get install -y debootstrap)
thisdir=./squeeze-distro
# create chroot system
# debootstrap stable ${thisdir} http://ftp.us.debian.org/debian
debootstrap --arch i386 squeeze ${thisdir} http://archive.debian.org/debian/
# mount devices
dirs=(/dev /dev/pts /dev/shm /tmp)
@mauricioprado00
mauricioprado00 / monitor-user-crontabs.sh
Last active August 16, 2017 09:07
Monitor users without a crontab
#!/usr/bin/env bash
cat <<EOF > /usr/local/etc/icinga-crontabs.sh
#!/usr/bin/env bash
function cleanup-dir() {
rm -Rf /icinga/crontabs
mkdir -p /icinga/crontabs
chmod -R 444 /icinga/
chmod 555 /icinga /icinga/crontabs
}