Skip to content

Instantly share code, notes, and snippets.

@akagisho
akagisho / keymap.c
Last active October 31, 2021 05:45
/* Copyright 2020 sekigon-gonnoc
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@akagisho
akagisho / Vagrantfile
Created October 24, 2021 04:30
Vagrantfile for Keyboard Quantizer
Vagrant.configure('2') do |config|
config.vm.box = 'ubuntu/focal64'
config.vm.hostname = 'qmk'
config.vm.provider :virtualbox do |vb|
vb.gui = false
end
config.vm.provision 'shell', inline: <<-SHELL
apt update
#!/usr/bin/env perl
use warnings;
use strict;
my $msg = {};
my $delivery = {};
while (<>) {
if ($_ =~ /^([^\s]+) info msg ([\d]+): bytes [\d]+ from ([^\s]+)/) {
#!/usr/bin/env python
import sys
from datetime import datetime
import Adafruit_DHT as DHT
SENSOR_TYPE = DHT.DHT22
DHT_GPIO = 18
print(datetime.now().strftime('%Y/%m/%d %H:%M:%S') + "\t"),
#!/usr/bin/env python
import sys
import os
import stat
import datetime
import pyexiv2
argvs = sys.argv
argc = len(argvs)
@akagisho
akagisho / apalogconvert.py
Created June 6, 2018 01:18
Apache のログの日時を Excel が認識できる形式に変換
#!/usr/bin/env python
import sys
import re
from datetime import datetime
for line in sys.stdin:
m = re.search('\[(\d{2}/[A-Z][a-z]{2}/\d{4}:\d{2}:\d{2}:\d{2}) .{0,6}\]', line)
if m:
d = datetime.strptime(m.group(1), '%d/%b/%Y:%H:%M:%S')
#!/usr/bin/env python
import sys
import re
from datetime import datetime
ips = []
count = []
first = []
last = []
FROM ubuntu:xenial
MAINTAINER akagisho <akagisho@gmail.com>
RUN sed -i -e "s|http://archive.ubuntu.com/|http://jp.archive.ubuntu.com/|" /etc/apt/sources.list
RUN apt update \
&& apt install -y sudo curl git libfontconfig-dev fonts-takao* chromium-browser supervisor
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
const viewportWidth = 1200;
const viewportHeight = 900;
const argv = process.argv;
var path = require('path');
const puppeteer = require('puppeteer');
if (argv.length < 3) {
console.error('Usage: node ' + path.basename(argv[1]) + ' <path> <url>');
process.exit(1);
@akagisho
akagisho / import_templates.php
Created September 18, 2017 08:39
Import Zabbix's Templates
<?php
require_once 'vendor/autoload.php';
use ZabbixApi\ZabbixApi;
$url = $argv[1];
$user = $argv[2];
$pass = $argv[3];
$file = $argv[4];