Skip to content

Instantly share code, notes, and snippets.

View datatypevoid's full-sized avatar

Null Void datatypevoid

View GitHub Profile
"""Generic linux daemon base class for python 3.x."""
import sys
import os
import time
import atexit
import signal
class Daemon:
"""A generic daemon class.
@datatypevoid
datatypevoid / bash-pipe-operator.sh
Last active October 19, 2017 22:30
Use the Bash built-in conditional unset substitution syntax. Reference: https://stackoverflow.com/a/36432966/4647818
#!/usr/bin/env bash
# echo x | myfunc && myfunc y
function myfunc() {
declare MY_INPUT=${*:-$(</dev/stdin)}
for PARAM in $MY_INPUT; do
# do what needs to be done on each input value
done
}
@datatypevoid
datatypevoid / install-rapidjson.sh
Last active October 15, 2017 17:08
Download RapidJSON (version 1.1.0), build from source, install, and clean-up.
#!/usr/bin/env bash
# install-rapidjson.sh:
# Download RapidJSON (version 1.1.0), build from source, install,
# and clean-up.
# Tested on Ubuntu.
# Dependencies:
# - CMake
# - git
# - rm
@datatypevoid
datatypevoid / install-sole.sh
Created October 14, 2017 17:40
Download Sole (version 1.0.0), install, and clean-up. Tested on Ubuntu
#!/usr/bin/env bash
# install-sole.sh:
# Download Sole (version 1.0.0), install, and clean-up.
# Tested on Ubuntu.
# Dependencies:
# - git
# - rm
set -e
@datatypevoid
datatypevoid / gh-deploy-clone.sh
Created October 11, 2017 13:01 — forked from blvz/gh-deploy-clone.sh
Creates a deploy key and clones the repository.
#!/usr/bin/env bash
read -r -d '' usage << EOM
Usage:
gh-deploy-clone user/repo [ENVIRONMENT]
EOM
[ -z "$1" ] && echo && echo "$usage" && echo && exit 1
@datatypevoid
datatypevoid / install-slikenet.sh
Last active October 15, 2017 18:04
Download SLikeNet (version 0.1.0), build from source, install, and clean-up. Tested on Ubuntu.
#!/usr/bin/env bash
# install-slikenet.sh
# Download SLikeNet (version 0.1.0), build from source, install, and
# clean-up.
# Tested on Ubuntu.
# Dependencies:
# - build-essential
# - cmake
# - git
@datatypevoid
datatypevoid / install-cpp-redis.sh
Last active October 12, 2017 16:52
Download forked cpp_redis (version 4.1.0), build from source, install, and clean-up. Tested on Ubuntu.
#!/usr/bin/env bash
# install-cpp-redis.sh
# Download cpp_redis (version 4.1.0), build from source, install, and
# clean-up.
# Tested on Ubuntu.
# Dependencies:
# - build-essential
# - echo
# - rm
@datatypevoid
datatypevoid / uninstall-cpp-redis.sh
Created October 9, 2017 01:47
Remove cpp_redis from standard installation locations. Tested on Ubuntu.
#!/usr/bin/env bash
# uninstall-cpp-redis.sh:
# Remove cpp_redis from standard installation locations.
# Tested on Ubuntu.
# Dependencies:
# - rm
show_help() {
echo "usage: uninstall-cpp-redis.sh [--verbose|-v]"
@datatypevoid
datatypevoid / uninstall-cmake.sh
Last active October 9, 2017 01:30
Remove CMake from standard installation locations. Tested on Ubuntu.
#!/usr/bin/env bash
# uninstall-cmake.sh:
# Remove CMake from standard installation locations.
# Tested on Ubuntu.
# Dependencies:
# - rm
show_help() {
echo "usage: uninstall-cmake.sh [--verbose|-v]"
@datatypevoid
datatypevoid / uninstall-mongo-cxx-driver.sh
Last active October 9, 2017 01:32
Remove mongo-cxx-driver from standard installation locations. Tested on Ubuntu.
#!/usr/bin/env bash
# uninstall-mongo-cxx-driver.sh:
# Remove mongo-cxx-driver from standard installation locations.
# Tested on Ubuntu.
# Dependencies:
# - rm
show_help() {
echo "usage: uninstall-mongo-cxx-driver.sh [--verbose|-v]"