Skip to content

Instantly share code, notes, and snippets.

@mattintosh4
mattintosh4 / iperf.gp
Last active May 22, 2017 15:28
gnuplot
set term svg enhanced size 1280,960 background rgb "white"
set datafile separator "|"
set xdata time
set timefmt "%s"
set output "/dev/null"
plot "< sqlite3 /srv/nfs4/iperf3.sqlite3 'select * from IPERF where TIMESTAMP between strftime(\"%s\",datetime(\"now\",\"-3 days\")) and strftime(\"%s\",datetime(\"now\",\"-2 days\"));'" u ($1+9*60*60):3
x3_min = GPVAL_DATA_X_MIN
x3_max = GPVAL_DATA_X_MAX
plot "< sqlite3 /srv/nfs4/iperf3.sqlite3 'select * from IPERF where TIMESTAMP between strftime(\"%s\",datetime(\"now\",\"-2 days\")) and strftime(\"%s\",datetime(\"now\",\"-1 days\"));'" u ($1+9*60*60):3
@mattintosh4
mattintosh4 / lxc-docker-mastodon_1.sh
Last active May 14, 2017 15:52
LXC-Docker-Mastodon
#!/bin/bash
set -e
set -x
trap_exit(){
sudo lxc-stop -n mastodon_x || :
sudo lxc-destroy -n mastodon_x
}
trap trap_exit EXIT
db_prefix = "/srv/nfs4/"
db(f) = db_prefix . f . ".sqlite3"
hexcolor(r, g, b) = sprintf("#%02x%02x%02x", r, g, b)
set term svg enhanced size 1024,480 background rgb "white"
set output "/opt/local/nginx/html/sensors/g2_brightness.svg"
set datafile separator ","
set xdata time
set timefmt "%Y-%m-%d %H:%M:%S"
@mattintosh4
mattintosh4 / dht11.py
Last active March 4, 2017 12:34
sensors-py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import Adafruit_DHT as DHT
import sqlite3
import sys
import time
from datetime import datetime
DB_FILE = "/nfs/DHT11.sqlite3"
@mattintosh4
mattintosh4 / dht11.sql
Last active March 4, 2017 16:38
sensors
/* SQLite 3.16.2 */
select
*
from
DHT11
where
ROWID > (select max(ROWID) from DHT11) - 10
union all select 'Max within 24 hours', max(TEMP) , max(HUMIDITY) from DHT11 where DATE >= datetime('now','-24 hours','localtime')
union all select 'Avg within 24 hours',printf('%2d',avg(TEMP)),printf('%2d',avg(HUMIDITY)) from DHT11 where DATE >= datetime('now','-24 hours','localtime')
#!/bin/bash
set -e
set -x
qaac64(){
QAAC64=~/Applications/qaac_2.59/x64/qaac64.exe
export WINEDEBUG=fixme-all
wine "${QAAC64}" "${@}"
}
@mattintosh4
mattintosh4 / gist:d9eb65b92cd2da509bc2
Last active May 1, 2019 20:22
Arch Linux ARM disk image creator
#!/bin/sh
set -e
set -u
set -x
# Environment variables
export PATH=/usr/bin:/bin:/usr/sbin:/bin
export LANG=en_US.UTF-8
# External commands
@mattintosh4
mattintosh4 / gist:b2b206060d62a42b42f4
Last active December 20, 2015 14:28
カラオケメーカー by VLC
#!/bin/sh
set -e
set -x
case ${VLC} in
"")
VLC=`which vlc`
;;
esac
test -x "${VLC}"
@mattintosh4
mattintosh4 / gist:ee0cbbfb5fdff44ff5ed
Last active December 19, 2015 05:05
艦これ一覧めーかーカッコカリ
#!/bin/sh
set -e
# watermark font
font="Noto-Sans-CJK-JP-Bold"
# watermark color
color="#0004"
# arguments process
public class cbccee4e {
public static void main(String[] args) {
int[] c1;
c1 = new int[3];
c1[0] = 1;
c1[1] = 2;
c1[2] = 3;
for (int i = 0; i < 3; i++) {
System.out.println(c1[i]);
}