Skip to content

Instantly share code, notes, and snippets.

@blamh
blamh / generate.sh
Created January 31, 2017 21:41
Script for creating self signed ssl certs with alt names
#!/bin/bash
CERT_NAME="dev_cert"
TOP_DEV_DOMAIN="example.dev"
DOMAINS=(
"DNS:$TOP_DEV_DOMAIN"
"DNS:*.$TOP_DEV_DOMAIN"
"DNS:*.level2.$TOP_DEV_DOMAIN"
"DNS:*.level3.level2.$TOP_DEV_DOMAIN"
)
@blamh
blamh / websrv.go
Last active August 29, 2015 14:18
Test Webserver in go
package main
import (
"fmt"
"net/http"
"time"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "URL:%s, TIME:%s", r.URL.Path[1:], time.Now())
@blamh
blamh / Daemon.php
Last active January 3, 2016 20:49
PHP Class for running a script as daemon in Linux. The script is started in the background by itself, to stop the daemon use filename.xphp --stop.
<?php
/**
* Class for running a script as daemon in Linux. The script is started
* in the background by itself, to stop the daemon use filename.xphp --stop.
*
* $d = new Library_Cmd_Daemon('daemon.pid');
* $d->run(function() {
* while(1) {
* sleep(10);
@blamh
blamh / gist:7979186
Created December 15, 2013 22:28
My Transmission config file
{
"alt-speed-down": 50,
"alt-speed-enabled": false,
"alt-speed-time-begin": 540,
"alt-speed-time-day": 127,
"alt-speed-time-enabled": false,
"alt-speed-time-end": 1020,
"alt-speed-up": 50,
"bind-address-ipv4": "0.0.0.0",
"bind-address-ipv6": "::",
@blamh
blamh / mysql_php_tzinfo_to_sql.php
Last active December 14, 2015 18:59
Script for importing timezone information from PHP into MySQL. Works by gathering information before removing the existing information from the MySQL tables. The gathering process takes ~17 sec. and the inserting takes only ~0.6 sec. This script decreases the downtime wwith about 2700% Modified from the example in php|architect’s Guide to Date a…
#!/usr/bin/env php
<?php
/**
* Script for importing timezone information from PHP into MySQL.
* Modified from the example in php|architect’s Guide to Date and
* Time Programming by Derick Rethans.
* Works by gathering information before removing the existing information
* from the MySQL tables.
* The gathering process takes ~17 sec. and the inserting takes only ~0.6 sec.