Skip to content

Instantly share code, notes, and snippets.

View szaydel's full-sized avatar

Sam Zaydel szaydel

  • RackTop Systems
  • Moss Beach
View GitHub Profile
#!/bin/sh
# Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh
set -e
# Must be a valid filename
NAME=foo
PIDFILE=/var/run/$NAME.pid
#This is the command to be run, give the full pathname
DAEMON=/usr/local/bin/bar
import zmq
import threading
import time
from random import choice
class ClientTask(threading.Thread):
"""ClientTask"""
def __init__(self):
threading.Thread.__init__ (self)
#!/usr/bin/env bash
# Bash Stack
set -o errtrace
set -o errexit
set -o nounset
declare -a stack
#!/bin/bash
( while read L
do echo $L > /tmp/pubkey
printf "%-16s => " $(cut -f 3 -d ' ' /tmp/pubkey)
ssh-keygen -l -f /tmp/pubkey
done
rm /tmp/pubkey
) < .ssh/authorized_keys
@szaydel
szaydel / supervisord
Last active December 19, 2015 16:29 — forked from danmackinlay/supervisord.sh
init.d script to manage supervisord process.
#! /bin/sh
### BEGIN INIT INFO
# Provides: supervisord
# Required-Start: $local_fs $remote_fs $networking
# Required-Stop: $local_fs $remote_fs $networking
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts supervisord - see http://supervisord.org
# Description: Starts and stops supervisord as needed - see http://supervisord.org
### END INIT INFO
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.

Add the following chunk to your existing ISC dhcpd.conf file.

if exists user-class and ( option user-class = "iPXE" ) {
    filename "http://boot.smidsrod.lan/bootstrap.ipxe";
}
else {
    filename "undionly.kpxe";
}

(or see https://gist.github.com/4008017 for a more elaborate setup

description "Upstart script to run rsync replication between datasets"
author "Sam Zaydel"
env NODE_BIN=/usr/bin/node
env NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript
env APP_DIR=/opt/zfs-poola-rsync/bin
env SCRIPT_FILE="runme.js" # Entry point for the nodejs app
env LOG_FILE=/var/log/zfs-poola-rsync.log
env RUN_AS="root" # Upstart can only be run nicely as root, need to drop privileges
#env SERVER_ENV="anything" # Usual apps can be run in different environments (development, test, production ...)

Project

Description: What does this project do and who does it serve?

Project Setup

How do I, as a developer, start working on the project?

  1. What dependencies does it have (where are they expressed) and how do I install them?
  2. How can I see the project working before I change anything?
#
# Place this code to your .profile, .bashrc, .bash_profile or whatever
#
function program_exists -d "Check if program is valid"
type "$1" &> /dev/null ;
end
function setup_goroot