Skip to content

Instantly share code, notes, and snippets.

@stanaka
stanaka / gist:7023521711e6a55a9b4577ddd9ceaefa
Created September 2, 2026 00:48
One HTML file to generate a QR code without any dependencies
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="A private, dependency-free QR code generator that runs entirely in your browser.">
<title>Offline QR Code Generator</title>
<style>
:root {
color-scheme: light;
@stanaka
stanaka / anomaly_detection.rb
Created April 15, 2016 01:20
Simple Anomaly Detection for Mackerel
#! /usr/bin/env ruby
require "mackerel"
require "net/http"
require "uri"
require "pp"
require "date"
@mackerel_api_key = "<APIKEY>"
service = "<SERVICE>"
@stanaka
stanaka / mackerel-graph-builder.html
Last active December 7, 2016 13:15
save this html as a local file, then open the file.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Mackerel Graph Builder</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
function update() {
var d = $("#def")[0].value;
var o = $("#org")[0].value;
@stanaka
stanaka / mackerel_estimate_filesystem_lifetime.py
Created December 20, 2015 13:28
Estimate filesystem lifetime with Mackerel
# -*- coding: utf-8 -*-
import requests
import time
import json
from StringIO import StringIO
import re
import sys
import os
@stanaka
stanaka / mackerel_metric.py
Created December 20, 2015 13:27
Regression analysis with Mackerel
# -*- coding: utf-8 -*-
import requests
import time
import json
from StringIO import StringIO
import re
import sys
import os
#! /usr/bin/env ruby
$now = Time.now
$cmd = "/Users/stanaka/git/github.com/stanaka/mackerel-osx/smc"
def smc(item)
ret = `#{$cmd} read #{item}`
ret = ret.split(/\t/)
if ret[1]
ret[1].to_i
pidfile = "/usr/local/var/run/mackerel-agent.pid"
root = "/usr/local/var/mackerel-agent"
verbose = false
apikey = "APIKEY"
[plugin.metrics.battery]
command = "ruby /usr/local/bin/mackerel-osx-battery.rb"
#! /usr/bin/env ruby
$ioreg = `ioreg -r -n AppleSmartBattery`
$now = Time.now
def asb(item)
ret = $ioreg.match(/(#{item})[\"= ]+(\d+)$/)
ret[2].to_i
end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>io.mackerel</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
- Official Blog https://blog.docker.com/2014/10/announcing-docker-global-hack-day-2/
- Kick off presentation from the core team https://docker.com/community/globalhackday
-