Skip to content

Instantly share code, notes, and snippets.

View unau's full-sized avatar

Takeyuki Kojima unau

View GitHub Profile
@unau
unau / chapter.css
Last active February 20, 2018 05:02
プレゼンフレームワーク reveal.js にやっつけ chapter 機能をつける ref: https://qiita.com/unau/items/b133c62a3f0867c0efa4
header {
clear: both;
position: absolute;
top: 5px;
left: 5px;
z-index: 20;
}
@unau
unau / clap-loader.rb
Last active September 16, 2017 15:58
自分は SketchUp の Ruby コンソールで使うんだけど、開発中にいろいろスクリプトをいじったとして、Ruby コンソールで Matome.clap とやると更新のあったファイルだけリロードしてくれるようなもの
module Matome
@@clapLoader = nil
def self.clap(dir=nil)
if @@clapLoader then
@@clapLoader.reload
else
@@clapLoader = ClapLoader.new dir
end
end
@unau
unau / fbdice.sh
Created February 5, 2017 07:12
facebook の友達数の推移、投稿数の推移を API を使わずに取得する ref: http://qiita.com/unau/items/1147c1748b3a7a3901d1
#!/bin/bash
basedir=/mnt/virya/Downloads/facebook-takeyukikojima
htmldir=${basedir}/html
awk -v today=20170131 -f friends.awk ${htmldir}/friends.htm
# end of file
@unau
unau / file0.txt
Last active February 2, 2017 08:14
awk 歴 23 年のおっさんが 2017 年に知った awk の小技 : 「プログラムファイルの分割」と「処理対象ファイルごとの分岐」 ref: http://qiita.com/unau/items/f98cae3de8722d05e9c2
FILENAME == "test1.csv" {
...
}
#!/bin/bash
# Copyright (c) 2016 Takeyuki Kojima
# Released under the MIT license
# http://opensource.org/licenses/mit-license.php
declare -a gh=('a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 'u' 'v' 'w' 'x' 'y' 'z')
dir=/mnt/publicport/Pictures/★小島農園/2016/201607
basedir=/mnt/publicport/Pictures/★小島農園
@unau
unau / facebook_ppp4pc.py
Created August 5, 2015 15:41
python-fu : GIMP プラグイン : facebook の個人のページで、一体化して見えるプロフィール写真とカバー写真を作るあれ
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from gimpfu import *
class Rect:
def buildWithSelectionBounds(self, bounds):
self.nw = { "x": bounds[1], "y": bounds[2] }
self.se = { "x": bounds[3], "y": bounds[4] }
self.size = { "x": bounds[3] - bounds[1], "y": bounds[4] - bounds[2] }
@unau
unau / Inflector.js
Last active August 29, 2015 14:23
nougat : Node.js と GoogleAppsScript のどちらでも使えるライブラリを作るための、むりくり感のある枠組みの試み ref: http://qiita.com/unau/items/3b83fd815822ec588494
(this.UiApp ? nougat : require('nougat')).$(
'Inflector', this.UiApp ? {g: this} : {g: global, m: module},
function(glace) {
'use strict';
var Inflections = glace.require('./Inflections');
var Transliterator = glace.require('./Transliterator');
var Methods = glace.require('./Methods');
var defaults = glace.require('./defaults');
var isFunc = glace.require('./isFunc');
@unau
unau / file1.txt
Created February 18, 2015 16:05
与えられた小数に近い整数比を生成するジェネレータ ref: http://qiita.com/unau/items/46a98043557729db45be
>>> import rasi
>>> for i in rasi.rasi(0.315): print "%d/%d = %g : %g" % i
...
1/1 = 1 : 0.685
1/2 = 0.5 : 0.185
1/3 = 0.333333 : 0.0183333
3/10 = 0.3 : 0.015
4/13 = 0.307692 : 0.00730769
5/16 = 0.3125 : 0.0025
6/19 = 0.315789 : 0.000789474
@unau
unau / kick.sh
Last active August 29, 2015 14:13
メモ : コマンドライン引数をそのまま受け付けるような GET な http サービスにリクエストを投げつける shell script ref: http://qiita.com/unau/items/1d757150011d0a1b6478
#!/bin/bash
#kicker=wget
kicker=curl
host=localhost
port=19876
path=`for a in "$@"; do echo $a; done | awk -F '' 'BEGIN{OFS=ORS="";for(i=0;i<256;i++)o[sprintf("%c",i)]=i}{for(i=1;i<=NF;i++)$i=($i ~ /[[:alnum:]]/)?$i:"%" sprintf("%02X",o[$i])}{print "/" $0}'`
url=http://${host}:${port}${path}