Skip to content

Instantly share code, notes, and snippets.

@wizardfrag
wizardfrag / gist:5532597
Last active December 17, 2015 01:59
Convert a time string to an integer.
<?php
function string2int($string = "00:00:00") {
$seconds = 0;
$string_parts = explode(':', $string);
$exponent = 0;
while (($timepart = array_pop($string_parts)) !== NULL) {
$timepart = intval($timepart);
$seconds += intval($timepart * pow(60, $exponent));
$exponent++;
; <<>> DiG 9.8.3-P1 <<>> ipv6.freenode.net AAAA
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 49376
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;ipv6.freenode.net. IN AAAA
@wizardfrag
wizardfrag / gist:6691524
Created September 24, 2013 21:29
Owncloud config
server {
root /srv/owncloud;
index index.html index.htm index.php;
server_name xxxxx;
rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
* About to connect() to mirrors.fedoraproject.org port 443 (#0)
* Trying 209.132.181.16... * Connection refused
* Trying 213.175.193.206... * Connection refused
* Trying 152.19.134.146... * Connection refused
* Trying 85.236.55.6... * Connection refused
* Trying 2001:4178:2:1269::fed2... * Failed to connect to 2001:4178:2:1269::fed2: Network is unreachable
* Success
* Trying 2607:f188::dead:beef:cafe:fed1... * Failed to connect to 2607:f188::dead:beef:cafe:fed1: Network is unreachable
* Success
* Trying 2610:28:3090:3001:dead:beef:cafe:fed4... * Failed to connect to 2610:28:3090:3001:dead:beef:cafe:fed4: Network is unreachable
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
Currently logging to "gdb.txt".
Logs will be appended to the log file.
Output is being logged and displayed.
Id Target Id Frame
12 Thread 0x7fa39b7f9780 (LWP 26719) 0x00007fa39afcab9d in nanosleep ()
at ../sysdeps/unix/syscall-template.S:81
11 Thread 0x7fa395bd5700 (LWP 26727) 0x00007fa39afcab9d in nanosleep ()
at ../sysdeps/unix/syscall-template.S:81
10 Thread 0x7fa397bdd700 (LWP 26724) pthread_cond_wait@@GLIBC_2.3.2 ()
at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185

Keybase proof

I hereby claim:

  • I am wizardfrag on github.
  • I am dwhite (https://keybase.io/dwhite) on keybase.
  • I have a public key ASAQIhMRjnPkfac7aw4Fz1h7rqJ3_hYTKs2i8y2XOODQGAo

To claim this, I am signing this object:

CalledProcessError: Command '['/var/lib/cattle/config.sh', u'host-iptables']' returned non-zero exit status 254
2016-03-10 17:11:40,940 ERROR cattle [139660519961616] [utils.py:284] Failed to call (['/var/lib/cattle/config.sh', u'host-iptables'],) {'stderr': -2, 'cwd': '/var/lib/cattle', 'env': {'CATTLE_STATE_DIR': '/var/lib/rancher/state', 'CATTLE_SYSTEMD': 'true', 'HOME': '/root', 'CATTLE_CADVISOR_WRAPPER': 'cadvisor.sh', 'AGENT_PARENT_PID': '16859', 'CATTLE_AGENT_PIDNS': 'host', 'CATTLE_URL': 'http://rancher.minechasm.net/v1', 'SHLVL': '1', 'CATTLE_AGENT_LOG_FILE': '/var/log/rancher/agent.log', 'CATTLE_AGENT_IP': '163.172.130.239', 'RANCHER_AGENT_IMAGE': 'rancher/agent:v0.9.2', 'AGENT_CONF_FILE': '/var/lib/rancher/etc/agent.conf', 'CATTLE_ACCESS_KEY': '7D4A2A65B351BB9822D9', 'PATH': '/var/lib/cattle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'CA_CERT_FILE': '/var/lib/rancher/etc/ssl/ca.crt', 'CATTLE_STORAGE_URL': 'http://rancher.minechasm.net/v1', 'CATTLE_CONFIG_URL': 'http://ranche
~/P/t/lounge ❯❯❯ node -v
v6.2.1
~/P/t/lounge ❯❯❯ npm -v
3.9.3
~/P/t/lounge ❯❯❯ npm test
> thelounge@2.0.0-pre.2 test /Users/david/Projects/thelounge/lounge
> npm-run-all -c test:mocha lint
input {
file {
path => [ "/data/minecraft/*/logs/latest.log" ]
tags => ["minecraft"]
}
}
filter {
if "minecraft" in [tags] {
grok {