This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## CRAN ミラーを指定 | |
options(repos=list(CRAN="https://cran.rstudio.com/")); | |
## 起動時にロードするパッケージを追加 | |
local({ | |
pkgs <- getOption("defaultPackages"); | |
options(defaultPackages=c(pkgs, "lattice", "car")); | |
}); | |
## 零和対比をデフォルトに設定 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import random | |
def qsort(ls): | |
if len(ls) <= 1: return ls | |
p = ls[0] | |
return qsort([x for x in ls if x < p]) + \ | |
[p] + \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ====================================================================== * | |
* 補色残像のデモプログラム | |
* | |
* 参考) | |
* http://www.johnsadowski.com/color_illusion_tutorial.html | |
* http://www.adobe.com/jp/devnet/pdf/pdf_reference_archive.html | |
* ====================================================================== */ | |
static final String STIMULUS = "stimulus.jpg"; // 使用する画像 | |
static final int DURATION = 30; // 呈示時間(秒) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int fps = 15; | |
int radius = 50; | |
int cycle = 5; // 回転周期 | |
int speed = 5; // 拡散速度 | |
int degree = 360 / (cycle * fps); | |
void setup() { | |
size(200, 200); | |
frameRate(fps); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Sub SaveAsCSV() | |
'============================== | |
' 使用しているデータ範囲の取得 | |
'============================== | |
Dim maxRow As Long | |
Dim maxCol As Long |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 半角 ⇒ 全角 | |
*/ | |
String halfToFull(String value) { | |
StringBuilder sb = new StringBuilder(value); | |
for (int i = 0; i < sb.length(); i++) { | |
int c = (int) sb.charAt(i); | |
if ((c >= 0x30 && c <= 0x39) || (c >= 0x41 && c <= 0x5A) || (c >= 0x61 && c <= 0x7A)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Singleton { | |
private Singleton(){} | |
public static Singleton getInstance() { | |
return SingletonHolder.instance; | |
} | |
private static class SingletonHolder { | |
static final Singleton instance = new Singleton(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
for file in *.jpg | |
do | |
out=${file%.*}.png | |
convert $file -rotate 90 $out | |
touch -r $file $out | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import csv | |
with open("sample.csv", "r") as f: | |
reader = csv.reader(f) | |
header = next(reader) # ヘッダを読み飛ばす | |
for row in reader: # 1 行ずつ文字列のリストとして読み込む | |
print(",".join(row)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# -*- coding: utf-8 -*- | |
SRC="$1" | |
DIR=$(dirname "$SRC") | |
BASE=$(basename "$SRC") | |
EXT=$(echo "${BASE##*.}" | tr A-Z a-z) | |
## 撮影日時を取得 |
OlderNewer