View tensorflow_gpu_test.py
# 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()
View ddr_score_detect.py
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)
View disable-video-acpi.service
[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
View archlinuxinstallbattle
BIOS+GPT環境で起動してzshが立ち上がったところから
----
# loadkeys jp106
# ping -c 3 www.google.com
# lsblk(インストール先ディスク確認、以下/dev/sdaの例)
# gdisk /dev/sda
* /dev/sda1に100MB(/boot, コード8300)
View http_server.js
// 参考:
// 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",
View nginx.conf
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;
View MakeFile_for_AVR
# Make directory tree as below
#--------------------
#.
#├─ Makefile
#└─ src
# └─ main.c
#--------------------
# Project settings
PROG = hello
View post_slack_from_lambda.js
console.log('Loading function');
const https = require('https');
const url = require('url');
const SLACK_HOOK_URL = '<incoming webhook url>';
exports.handler = function(event, context) {
// prepare https POST request
const reqOptions = url.parse(SLACK_HOOK_URL);
reqOptions.method = 'POST';
View .eslintrc
{
"env": {
"node": true,
"es6": true
},
"rules": {
"array-bracket-spacing": [
2,
"never"
],
View levenshtein_distance.js
'use strict';
/*
Calculate Levenshtein distance(edit dstance) between str1 and str2.
*/
const calculateLevenshteinDistance = (str1, str2) => {
// Initialize distance table
let distanceTable = new Array(str1.length + 1);
for (let row = 0; row < str1.length + 1; row++) {
distanceTable[row] = new Array(str2.length + 1);