Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@nibral
nibral / Sunrise70.ino
Created June 1, 2022 05:43
Firmware for Sunrise70 keyboard
#include <bluefruit.h>
/*
キーコード
*/
#define FN_KEY 0x1000
#define FN_BLE_1 0x1001
#define FN_BLE_2 0x1002
#define FN_BLE_INFO 0x1003
#define FN_BLE_ADV 0x1004
# watch GPU status in windows
# while ($true -eq $true) { .\nvidia-smi.exe ; sleep 1 ; clear }
import tensorflow as tf
import six
tf.Session()
six.moves.input()
@nibral
nibral / ddr_score_detect.py
Created March 5, 2017 03:45
eAmuのDDRスコア画像を読み取るやつ
import sys
import cv2
# pattern matching
def find(image, template):
ret_i = 0
ret_val = 0
for i in range(len(template)):
res = cv2.matchTemplate(image, template[i], cv2.TM_CCORR_NORMED)
min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
@nibral
nibral / disable-video-acpi.service
Last active February 9, 2017 02:23
ThinkPad X200s Video ACPIモジュールによる輝度調整ホットキーの無効化
[Unit]
Description=Disable brightness control by ACPI video module
[Service]
Type=oneshot
ExecStart=/usr/bin/sh -c "/usr/bin/echo -n 0 > /sys/module/video/parameters/brightness_switch_enabled"
[Install]
WantedBy=multi-user.target
BIOS+GPT環境で起動してzshが立ち上がったところから
----
# loadkeys jp106
# ping -c 3 www.google.com
# lsblk(インストール先ディスク確認、以下/dev/sdaの例)
# gdisk /dev/sda
* /dev/sda1に100MB(/boot, コード8300)
// 参考:
// http://www.misuzilla.org/Blog/2016/01/31/CreateYourOwnHttpServerUsingCSharp
// http://qiita.com/akiray03/items/3607c60ec8b221b3c2ba (Node.jsはブロックしないよ!)
'use strict';
const net = require('net');
const HTTP_RESPONSE = [
"HTTP/1.0 200 OK",
@nibral
nibral / nginx.conf
Last active December 1, 2018 10:44
reverse proxy
server {
listen 80;
server_name example.com;
charset UTF-8;
auth_basic "Login message";
auth_basic_user_file /path/to/.htpasswd;
location / {
proxy_redirect off;
# Make directory tree as below
#--------------------
#.
#├─ Makefile
#└─ src
# └─ main.c
#--------------------
# Project settings
PROG = hello
@nibral
nibral / post_slack_from_lambda.js
Last active January 5, 2018 06:50
環境変数SLACK_WEBHOOK_URLを設定して使うこと
const https = require('https');
const url = require('url');
exports.handler = function(event, context) {
// prepare https POST request
const reqOptions = url.parse(process.env.SLACK_WEBHOOK_URL);
reqOptions.method = 'POST';
reqOptions.headers = {
'Content-Type': 'application/json'
};
{
"env": {
"node": true,
"es6": true
},
"rules": {
"array-bracket-spacing": [
2,
"never"
],