Skip to content

Instantly share code, notes, and snippets.

@blamh
blamh / generate.sh
Created Jan 31, 2017
Script for creating self signed ssl certs with alt names
View generate.sh
#!/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 Aug 29, 2015
Test Webserver in go
View websrv.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 Jan 3, 2016
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.
View Daemon.php
<?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 Dec 15, 2013
My Transmission config file
View gist:7979186
{
"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 Dec 14, 2015
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…
View mysql_php_tzinfo_to_sql.php
#!/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.
You can’t perform that action at this time.