Skip to content

Instantly share code, notes, and snippets.

View projectivemotion's full-sized avatar
👽
let's work

Amado Martinez projectivemotion

👽
let's work
View GitHub Profile
@projectivemotion
projectivemotion / zenneby.sh
Last active February 14, 2021 07:17
Reads shell commands from an ini file and displays a dialog box allowing a user to select and execute any of the comands.
#!/bin/bash
# github.com/projectivemotion
#
# This script displays a listbox and allows a user
# to select and execute any of the commands from a given
# ini file. (run.ini)
#
cd $(dirname "$0")
@projectivemotion
projectivemotion / provision.sh
Last active December 30, 2019 04:46
Cent OS 7 Provision Docker, Epel, Php, Nginx, Git Screen, Wget
#!/bin/bash
# epel
yum install -y epel-release
# docker
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce
systemctl enable docker
@projectivemotion
projectivemotion / gpg2qrcodes.sh
Last active September 9, 2021 04:47 — forked from joostrijneveld/gpg2qrcodes.sh
Producing printable QR codes for persistent storage of GPG private keys
#!/bin/bash
#1. export gpg private key as ascii
#2. split ascii into 4 qr code images
#3. generate bash script for importing bash images
#4. generate bash script for decrypting files.
gpg --export-secret-key --armor | split -C 1000 - IMG
for f in IMG*; do cat $f | qrencode -o $f.png; rm -vf $f; done
#learnmysql_init will pull mysql and phpmyadmin/phpmyadmin images from the registry
function learnmysql_intit {
#Change supersecretpassword to work in not trusted network.
docker run --name mysql -e MYSQL_ROOT_PASSWORD="supersecretpassword" -d mysql
docker run --name phpmyadmin -d --link mysql:db -p 8080:80 phpmyadmin/phpmyadmin
}
function learnmysql_stop {
docker stop mysql phpmyadmin
}
@projectivemotion
projectivemotion / timewarrior-tags-time-report.sh
Created January 14, 2017 05:21
Create a csv report of how much time was spent on each tag for the current month in TimeWarrior. https://taskwarrior.org/docs/timewarrior/what.html
#!/bin/env bash
# only tags without spaces are counted
#
hash JSON.sh 2>/dev/null || {
echo "https://github.com/dominictarr/JSON.sh is required."
exit 1
}
echo \"Tag\",\"Time\"
timew export :month | JSON.sh | grep -E '\[[0-9]+,"tags",' | cut -f2 | grep -v ' ' | sort | uniq | while read tag ; do
@projectivemotion
projectivemotion / start-service-if-host-unreachable.sh
Created January 11, 2017 10:05
Trigger a systemd service when a host becomes unreachable via ping. Machine can be hostname or ip address.
#!/bin/sh
# add to your crontab?
# 45 * * * * /path/to/start-service-if-host-unreachable.sh
machine="moto"
service="reverse-tunnel"
if [ "$USER" != "root" ] ; then
echo "You are not root. bye."
exit 1;
@projectivemotion
projectivemotion / Advanced Bash Usage CheatSheet.md
Last active August 25, 2018 16:28
Cheatsheet of advanced bash commands presented in Introduction to Advanced Bash Usage - James Pannacciulli. Youtube: https://youtu.be/uqHjc7hlqd0
@projectivemotion
projectivemotion / after.sh
Created December 29, 2016 00:45
Provision Homestead Vagrant with php5.6
#!/bin/bash
# save as after.sh in project root then run vagrant up
if [ "$USER" != "root" ] ; then
sudo /bin/bash "$0"
exit 0
fi
# install php5.6
apt-get update -y
@projectivemotion
projectivemotion / tinytinyrssdocker.md
Last active November 30, 2016 10:27
Run tiny tiny rss in docker container

Set Up tiny tiny rss in a docker container

Using clue/ttrss image: https://github.com/clue/docker-ttrss

I was having some problem configuring the container using DB_PASS and DB_USER variables. I ended up using DB_ENV_USER and DB_ENV_PASS and was able to get the container up and running;

docker run -d --name ttrssdb -e 'MYSQL_ROOT_PASSWORD=my-secret-pw' mariadb
sleep 20 && docker run --link ttrssdb:db -p 89:80 -e DB_ENV_USER=root -e DB_ENV_PASS=my-secret-pw -d --name ttrss clue/ttrss