Skip to content

Instantly share code, notes, and snippets.

@anonymuse
anonymuse / FreeNAS.md
Created July 4, 2017 19:27 — forked from jacobblock/FreeNAS.md
Ultimate FreeNAS Setup

FreeNAS

I started using FreeNAS in August 2013. It is fantastic piece of software and I have been really impressed by the upgrades just in the few months I've been using it. It looks like they recently went to a plugin system as of version 9 to make installing software easier for end users. I've ran into several issues related to plugins and user + group permissions so I decided to just use the available FreeBSD port system. After fiddling for a few days (now turned into months) I believe I have created something helpful for the community and anyone interested in picking up the port system. The sandbox nature of FreeNAS's jail system is especially helpful for playing around without having any consequence on your core system.

Here are straight-forward instructions to setting up a bunch of different software on FreeNAS. If you make a terrible error, just throw up another plugin sandbox and repeat.

ToC

@anonymuse
anonymuse / create_swarm_cluster.sh
Created February 6, 2017 16:48 — forked from alexei-led/create_swarm_cluster.sh
Deploy Docker Compose (v3) to Swarm (mode) Cluster
#!/bin/bash
# vars
[ -z "$NUM_WORKERS" ] && NUM_WORKERS=3
# init swarm (need for service command); if not created
docker node ls 2> /dev/null | grep "Leader"
if [ $? -ne 0 ]; then
docker swarm init > /dev/null 2>&1
fi
@anonymuse
anonymuse / gist:abfa6d21ccc22ff6a13c
Created March 8, 2016 18:44 — forked from nikreiman/gist:5458386
A quick script to clean up Gerrit branches. I tend to have 1 branch per commit for Gerrit reviews, which means that after some time there are a ton of stale branches sitting around. This script examines all your branches, looking for ones which have a change-id that also exists in the current branch. If it has found such a commit, it prompts you…
function git-branch-current() {
printf "%s\n" $(git branch 2> /dev/null | grep -e ^* | tr -d "\* ")
}
function git-branch-cleanup() {
local currentBranch=$(git-branch-current)
local otherBranch=
for otherBranch in $(git branch | grep -v $currentBranch) ; do
printf "Branch %s:\n" "$otherBranch"
printf " HEAD commit is: %s\n" "$(git log --oneline -n 1 $otherBranch)"
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
#! /bin/bash
#
# This script needs "fpm". If you dont have it,
# run "gem install fpm"
#
# You also need to "apt-get install python-setuptools" (otherwise fpm fails)
clean() {
rm -rf whisper-0.9.9 carbon-0.9.9 graphite-web-0.9.9
#!/bin/bash
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# Forked from: http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Ubuntu 11.10 Oneiric Ocelot
# Forked from https://gist.github.com/1287170
# Modified to use NGinx + uwsgi instead of Apache, as well as memcached and supervisord, incorporating ideas from
# http://blog.adku.com/2011/10/scalable-realtime-stats-with-graphite.html
@anonymuse
anonymuse / main.yml
Created January 28, 2014 19:29 — forked from danrough/main.yml
- name: Create the service init scripts yo
template: src=service_init_script.j2 dest=/etc/init.d/{{ item.service_name }} owner=root group=root mode=755
with_items:
- { service_name: paymentHandler, service_description: 'Handles payments', service_user: blackjack_attack, service_exec: "{{ application_directory }}/apps/paymentHandler.js" }
- { service_name: tablePool, service_description: 'The pool of tables available', service_user: blackjack_attack, service_exec: "{{ application_directory }}/apps/tablePool.js" }
- { service_name: userManager, service_description: 'Manages users, apparently', service_user: blackjack_attack, service_exec: "{{ application_directory }}/apps/userManager.js" }
sudo: yes
#!/bin/bash
### BEGIN INIT INFO
# Provides: {{ item.service_name }}
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: {{ item.service_description }}
### END INIT INFO
Variables
==========
predefined variables :
- inventory_hostname (fqdn) (normally the same as ansible.fqdn)
- inventory_hostname_short
To know the return codes returned by ansible modules, just use plain ansible -vvv to see them :
ansible -i ~/ansible/arrfab.net/hosts/hosts.cfg -vvv -m copy -a 'src=files/sysinfo dest=/etc/sysinfo' tungstene.arrfab.net
tungstene.arrfab.net | success >> {
"changed": true,
- name: check out code
git: dest=path/to/dest repo=some_repo version=master
environment:
GIT_SSH: /tmp/git_ssh.sh
git_ssh.sh:
#!/bin/sh
exec /usr/bin/ssh -o StrictHostKeyChecking=no -i /path/to/git-identity "$@"