Skip to content

Instantly share code, notes, and snippets.

Avatar
🏝️
Living the dream

Jeffrey Clark h0tw1r3

🏝️
Living the dream
View GitHub Profile
@lantian
lantian / install.php
Last active Dec 19, 2015
Phalcon createTable
View install.php
<?php
foreach ($this->_getModels() as $model) {
$columns = array();
$primaries = array();
foreach ($model['columns'] as $columnName => $column) {
if (isset($column['is_primary']) && $column['is_primary']) {
$primaries = $columnName;
}
@jasonhancock
jasonhancock / puppet apache log analyzer
Created Aug 23, 2012
Analyze puppet's apache logs.
View puppet apache log analyzer
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
my $file = $ARGV[0] or die('Must pass an apache access logfile');
open IN, "<$file" or die("Can't open $file");
@andrewkroh
andrewkroh / fstab.pp
Created Aug 9, 2014
Configuring /etc/fstab with Puppet Augeas
View fstab.pp
augeas{ '/etc/fstab - nosuid on /sys':
context => "/files/etc/fstab",
changes => [
"ins opt after /files/etc/fstab/*[file = '/sys']/opt[last()]",
"set *[file = '/sys']/opt[last()] nosuid",
],
onlyif => "match *[file = '/sys']/opt[. = 'nosuid'] size == 0",
}
augeas{ '/etc/fstab - acl on /sys':
View manifests__site.pp
node demo {
nagios::host::service { 'ping':
check_command => 'check_ping',
}
}
@rday
rday / gist:3504674
Created Aug 28, 2012
Abstract wrapper to allow connection pools
View gist:3504674
type InitFunction func() (interface{}, error)
type ConnectionPoolWrapper struct {
size int
conn chan interface{}
}
/**
Call the init function size times. If the init function fails during any call, then
the creation of the pool is considered a failure.
@ebirn
ebirn / runkexec
Last active Nov 15, 2017
kexec latest kernel on Centos 6
View runkexec
#!/bin/sh
VERSION=$(ls -t1 /boot/vmlinuz-* | cut -f 1 -d '-' --complement | head -1)
BOOT=/boot
KEXEC=/sbin/kexec
KERNEL=$BOOT/vmlinuz-$VERSION
INITRD=$BOOT/initramfs-$VERSION.img
@joshenders
joshenders / sabnzbdplus.default
Last active Dec 8, 2017
Installing sabnzbdplus on Debian Wheezy from source
View sabnzbdplus.default
# This file is sourced by /etc/init.d/sabnzbdplus
#
# When SABnzbd+ is started using the init script, the
# --daemon option is always used, and the program is
# started under the account of $USER, as set below.
#
# Each setting is marked either "required" or "optional";
# leaving any required setting unconfigured will cause
# the service to not start.
@zorab47
zorab47 / offline_template.rb
Created Nov 22, 2011
Offline Template for Rails 2.3.x
View offline_template.rb
# Public: Template to render views outside the context of a controller.
#
# Useful for rendering Rails 2.3.x views in rake tasks or background jobs when a
# controller is unavailable.
#
# Examples
#
# template = OfflineTemplate.new(:users)
# template.render("users/index", :layout => false, :locals => { :users => users })
#
@lukespragg
lukespragg / sign4j.c
Last active Aug 2, 2018
Sign4j for Linux
View sign4j.c
/*
sign4j.c: a simple utility to sign executables created by Launch4j
Copyright (c) 2012 Grzegorz Kowal
Modified for Linux by Luke Spragg (Wulfspider), Dalton Pelc (Olloth), Contex, and raphfrk
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@dalenoe
dalenoe / unifi_ssl_import.sh
Last active Oct 14, 2018 — forked from stevejenkins/unifi_ssl_import.sh
Import and use SSL certificates (including Let's Encrypt) with the Ubiquiti UniFi Controller on Unix/Linux Systems
View unifi_ssl_import.sh
#!/usr/bin/env bash
# unifi_ssl_import.sh
# UniFi Controller SSL Certificate Import Script for Unix/Linux Systems
# by Steve Jenkins <http://www.stevejenkins.com/>
# Incorporates ideas from https://source.sosdg.org/brielle/lets-encrypt-scripts
# Version 2.2
# Last Updated June 26, 2016