Skip to content

Instantly share code, notes, and snippets.

View rhoop's full-sized avatar

Will Hoop rhoop

View GitHub Profile
@rhoop
rhoop / mgoExample.go
Created May 4, 2018 05:20 — forked from border/mgoExample.go
mgo example
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"time"
)
type Person struct {
@rhoop
rhoop / nomad.sh
Created July 13, 2017 20:27
start cluster
#!/bin/bash
#
# Startup script for nomad
#
# chkconfig: 345 86 14
# description: Nomad Server
# processname: nomad
# pidfile: /var/run/nomad.pid
#
### BEGIN INIT INFO
@rhoop
rhoop / mysql_query_cache_fIt_check.sql
Last active March 8, 2017 06:11
Does your query cache fit into memory?
USE information_schema;
SET @page_size = @@innodb_page_size;
SET @bp_pages = @@innodb_buffer_pool_size/@page_size;
SELECT P.TABLE_NAME, P.PAGE_TYPE,
CASE WHEN P.INDEX_NAME IS NULL THEN NULL WHEN P.TABLE_NAME LIKE '`SYS_%' THEN P.INDEX_NAME WHEN P.INDEX_NAME <> 'PRIMARY' THEN 'SECONDARY' ELSE 'PRIMARY' END AS INDEX_TYPE,
COUNT(DISTINCT P.PAGE_NUMBER) AS PAGES,
ROUND(100*COUNT(DISTINCT P.PAGE_NUMBER)/@bp_pages,2) AS PCT_OF_BUFFER_POOL,
CASE WHEN P.TABLE_NAME IS NULL THEN NULL WHEN P.TABLE_NAME LIKE 'SYS_%' THEN NULL ELSE ROUND(100*COUNT(DISTINCT P.PAGE_NUMBER)/CASE P.INDEX_NAME WHEN 'PRIMARY' THEN TS.DATA_LENGTH/@page_size ELSE TS.INDEX_LENGTH/@page_size END, 2) END AS PCT_OF_INDEX
FROM INNODB_BUFFER_PAGE AS P
defaults write com.apple.notificationcenterui bannerTime SECONDS
@rhoop
rhoop / ping.sh
Created March 1, 2015 01:35
Ping Times Are Still Bad
PING 8.8.8.8 (8.8.8.8): 56 data bytes
Request timeout for icmp_seq 0
64 bytes from 8.8.8.8: icmp_seq=1 ttl=56 time=11.822 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=56 time=12.853 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=56 time=12.298 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=56 time=12.360 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=56 time=21.016 ms
64 bytes from 8.8.8.8: icmp_seq=6 ttl=56 time=13.369 ms
Request timeout for icmp_seq 7
Request timeout for icmp_seq 8