Skip to content

Instantly share code, notes, and snippets.

👽
let's work

Amado Martinez projectivemotion

👽
let's work
View GitHub Profile
@projectivemotion
projectivemotion / provision.sh
Last active Dec 30, 2019
Cent OS 7 Provision Docker, Epel, Php, Nginx, Git Screen, Wget
View provision.sh
#!/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 Apr 1, 2019 — forked from joostrijneveld/gpg2qrcodes.sh
Producing printable QR codes for persistent storage of GPG private keys
View gpg2qrcodes.sh
#!/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
View startmysqlondocker.sh
#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 Jan 14, 2017
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
View timewarrior-tags-time-report.sh
#!/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 Jan 11, 2017
Trigger a systemd service when a host becomes unreachable via ping. Machine can be hostname or ip address.
View start-service-if-host-unreachable.sh
#!/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 Aug 25, 2018
Cheatsheet of advanced bash commands presented in Introduction to Advanced Bash Usage - James Pannacciulli. Youtube: https://youtu.be/uqHjc7hlqd0
View Advanced Bash Usage CheatSheet.md
@projectivemotion
projectivemotion / after.sh
Created Dec 29, 2016
Provision Homestead Vagrant with php5.6
View after.sh
#!/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 Nov 30, 2016
Run tiny tiny rss in docker container
View tinytinyrssdocker.md

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
View timewarrior-cheatsheet.md
You can’t perform that action at this time.