Skip to content

Instantly share code, notes, and snippets.

View yuntan's full-sized avatar
💼
full time worker

Yuto Tokunaga yuntan

💼
full time worker
View GitHub Profile
@yuntan
yuntan / nicovideo.py
Created June 1, 2014 17:10
ニコ動からあらかじめ取ってきたJSONを解析して動画情報を表示するだけ
#!/usr/bin/env python3
"""nicovideo.py: parse json and show video info"""
__author__ = "Yuto Tokunaga"
import sys
import os
import glob
import json
@yuntan
yuntan / gist:48c2b86f6fe9431a6cf0
Last active August 29, 2015 14:03
raspiでGPIOを使ってみる 〜LEDでLoad Average〜

green

GPIO with raspi第一回(?)

ロードアベレージの高さに応じてLEDを点灯させる

  • ロードアベレージが低い[0,2)→緑
  • ちょっとしんどい[2,5)→黄
  • しんどい[5,∞)→赤
@yuntan
yuntan / code1 output.txt
Created February 5, 2015 13:38
cgo: function scope variable and package scope variable
Driver Capability:
Driver: "uvcvideo"
Card: "UCAM-DLN130T series"
Bus: "usb-0000:00:14.0-2"
Capabilities: 84000001
using System;
using System.Linq;
using System.Collections.Generic;
public class Hello{
public static void Main(){
// Here your code !
var t = new {a = 0f, b = 0f};
Func<float, object> hoge = (float x) => new {a = x+1, b = x-1};
@yuntan
yuntan / README.md
Created April 3, 2015 13:09
go-qml os/exec.Cmd.Run SIGTRAP

environment

go 1.4 linux/amd64 Qt 5.4.1 Arch Linux

problem

Application is terminated due to core dump with signal trace/breakpoint trap, when the ls command is executed.

@yuntan
yuntan / README.md
Last active August 29, 2015 14:21
QFontMetrics test

Output

Qt 4.8.6 On Arch Linux:

"Ricty,10,-1,5,50,0,0,0,0,0" 
width of  'あ'  =  13 
width of  '南'  =  13

Qt 5.4.1 On Arch Linux:

"Ricty,10,-1,5,50,0,0,0,0,0"

package main
import (
"encoding/csv"
"fmt"
"html/template"
"os"
"strconv"
"strings"
)
@yuntan
yuntan / index.html
Created June 12, 2015 12:17
大阪府の人口密度
<!DOCTYPE html>
<html>
<head>
<title>大阪府の人口密度</title>
</head>
<body>
<canvas id="canvas" width="640" height="640"></canvas>
<script type="text/javascript" src="http://underscorejs.org/underscore-min.js"></script>
<script type="text/javascript">
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yuntan
yuntan / bf1.hs
Created July 12, 2015 05:49
moudame
import Data.Char
import Data.List
import Text.Regex
import Text.Regex.Base.RegexLike
splitJmp :: String -> (String, String)
splitJmp ss =
let isLoop s = head s == '[' && last s == ']' && matchCount (mkRegex "\\[") s == matchCount (mkRegex "\\]") s in
case elemIndex True $ map (\i -> isLoop $ take i ss) [1..length ss] of
Just i -> (init . tail $ take i ss, drop i ss)