Skip to content

Instantly share code, notes, and snippets.

@thehunmonkgroup
thehunmonkgroup / jekyll-git-push.sh
Created January 14, 2015 22:31
Deploy a Jekyll site to a non-bare repository via git push
#!/bin/bash
#
# Utility script which can be used to trigger rebuild of a jekyll site that is
# managed via a git repository. Most often, you would call this script in the
# post-receive hook of a full (non-bare) git repository, such that the rebuild
# happens after a push.
#
# Run with no arguments for usage.
#
#!/bin/bash
#
# chkconfig: 35 90 12
# description: Start node apps.
#
# This grabs the name of the init script. The weird string match handles
# the case when the init script is called on boot as /etc/rcN/S90[name].
INIT_SCRIPT_BASENAME=`basename $0`
SERVICE=${INIT_SCRIPT_BASENAME#S90}
@thehunmonkgroup
thehunmonkgroup / monit-managed-service.sh
Last active September 29, 2015 15:35
Redhat-style init script to manage a service using monit commands
#!/usr/bin/env sh
#
# chkconfig: - 99 12
# description: Start apps, monit wrapper.
#
# This script uses the monit process to handle starting and stopping a
# service. This can be used in server configuration management software to
# manage the service programatically, in the case where it's already being
# managed via monit.
@thehunmonkgroup
thehunmonkgroup / apply_sysctl.sh
Created January 14, 2015 06:37
Shell script to reload all files in /etc/sysctl.d/
#! /bin/bash
# Source function library.
. /etc/init.d/functions
apply_sysctl
@thehunmonkgroup
thehunmonkgroup / customize
Last active March 14, 2017 07:27
Debian scripts for starting/stopping a ramdisk
#!/bin/sh
RAMDISK_SIZE="256m"
MOUNT_POINT="/mnt/ramdisk"
USER=root
GROUP=root
PERMISSIONS=775
PRE_STOP_SCRIPT="/usr/local/bin/stop_ramdisk.sh"
/**
* Illustrates methods for testing for the existence of support
* for setting a speaker device.
*/
// Check for the setSinkId() method on HTMLMediaElement.
if (setSinkId in HTMLMediaElement.prototype) {
// Do the work.
}
[:~/git … rm/live/staging/provider-pre/gcp] staging+ 1 ± TF_LOG=DEBUG terraform apply
2020/03/21 21:10:28 [WARN] Log levels other than TRACE are currently unreliable, and are supported only for backward compatibility.
Use TF_LOG=TRACE to see Terraform's internal logs.
----
2020/03/21 21:10:28 [INFO] Terraform version: 0.12.24
2020/03/21 21:10:28 [INFO] Go runtime version: go1.12.13
2020/03/21 21:10:28 [INFO] CLI args: []string{"/usr/local/bin/terraform", "apply"}
2020/03/21 21:10:28 [DEBUG] Attempting to open CLI config file: /home/hunmonk/.terraformrc
2020/03/21 21:10:28 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/03/21 21:10:28 [INFO] CLI command args: []string{"apply"}
/**
* iOS doesn't support beforeunload, use pagehide instead.
* NOTE: I tried doing this detection via examining the window object
* for onbeforeunload/onpagehide, but they both exist in iOS, even
* though beforeunload is never fired.
*/
var iOS = ['iPad', 'iPhone', 'iPod'].indexOf(navigator.platform) >= 0;
var eventName = iOS ? 'pagehide' : 'beforeunload';
window.addEventListener(eventName, function (event) {
#!/bin/sh
# nfsserver
#
# Description: Manages NFS server as OCF resource
# by hxinwei@gmail.com
# NFSv4-only modifications by thehunmonkgroup at gmail dot com
# License: GNU General Public License v2 (GPLv2) and later
if [ -n "$OCF_DEBUG_LIBRARY" ]; then
. $OCF_DEBUG_LIBRARY
--[[
Wrapper for freeswitch.Dbh to fetch results into an indexed table of
assocative tables.
]]
function db_fetch(dbh, sql)
local rows = {}
dbh:query(sql, function(data)
local row = {}
for col, val in pairs(data) do
row[col] = val