Skip to content

Instantly share code, notes, and snippets.

View onnimonni's full-sized avatar

Onni Hakala onnimonni

View GitHub Profile
@onnimonni
onnimonni / 0_reuse_code.js
Created June 9, 2017 08:43
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@onnimonni
onnimonni / env-susbst.sh
Last active August 3, 2016 20:28 — forked from pebo/env-susbst.sh
envsubst like substitution; only replacing $VAR or ${VAR} if they have a value in in env
View env-susbst.sh
#!/bin/bash
# envsubst like substitution; only replacing ${VAR} if they exists
# based on http://mywiki.wooledge.org/TemplateFiles
# source: https://gist.github.com/pebo/c30d9b4819e908a305244874c916a4dc
while read -r; do
while [[ $REPLY =~ \$(\{([a-zA-Z_][a-zA-Z_0-9]*)\})(.*) ]]; do
if [[ -n ${!BASH_REMATCH[2]} ]]; then
printf %s "${REPLY%"$BASH_REMATCH"}${!BASH_REMATCH[2]}"
else
printf %s "${REPLY%"$BASH_REMATCH"}\$${BASH_REMATCH[2]}"
@onnimonni
onnimonni / run-wp-cron.sh
Created July 7, 2016 12:49 — forked from bjornjohansen/run-wp-cron.sh
Run all due cron events for WordPress with WP-CLI. Works with both single sites and multisite networks.
View run-wp-cron.sh
#!/bin/bash
# Copyright © 2015 Bjørn Johansen
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
# Source: https://bjornjohansen.no/wordpress-cron-wp-cli
# Github: https://gist.github.com/bjornjohansen/a00a9fee5475c4dadb56#file-run-wp-cron-sh
# This is modified for our container. In this container you don't need to use --path
# because it's automatically included
@onnimonni
onnimonni / ufw.md
Created April 19, 2015 09:20 — forked from kimus/ufw.md
View ufw.md

UFW

I use Ubuntu’s Uncomplicated firewall because it is available on Ubuntu and it's very simple.

Install UFW

if ufw is not installed by default be sure to install it first.

View gist:c0e6fcd565fcffe7c6a8