Skip to content

Instantly share code, notes, and snippets.

View PetteriVaarala's full-sized avatar

Petteri Vaarala PetteriVaarala

View GitHub Profile
@m-radzikowski
m-radzikowski / script-template.sh
Last active April 25, 2024 18:43
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@frenck
frenck / hassio_ubuntu_install_commands.sh
Last active February 1, 2023 05:38
Simple install command for installing Hass.io on a Generic Ubuntu/Debian machine
Unbuntu is no longer support by the Home Assistant project.
The installation commands previous listed here, are not up 2 date, not recommended, not supported and, therefore, removed.
@HeikkiVesanto
HeikkiVesanto / load_osm_history.py
Last active February 26, 2024 15:31
pipe osmium-tools extracts into PostgreSQL
import os
import psycopg2
import subprocess
def runogr2ogr(infile):
# import the data
try:
command = ["ogr2ogr", "-f", "PostgreSQL",
OGR_CONN_STRING,
@aaronhoffman
aaronhoffman / pre-commit
Created April 14, 2017 15:25
git hooks - prevent commit to local master branch and prevent push to remote master branch
#!/bin/sh
# prevent commit to local master branch
branch=`git symbolic-ref HEAD`
if [ "$branch" = "refs/heads/master" ]; then
echo "pre-commit hook: Can not commit to the local master branch."
exit 1
fi
exit 0