Skip to content

Instantly share code, notes, and snippets.

View tomoyk's full-sized avatar
🐳
Containerize

Tomoyuki KOYAMA tomoyk

🐳
Containerize
View GitHub Profile
@tomoyk
tomoyk / sample2.bash
Created May 16, 2017 08:23
等差数列みたいに5ずつ増やしていく
seq 1 5 100|xargs -I@ sh -c 'echo seq @\|xargs -I[at] sh -c \"echo -n +\"\;echo\ \;'|sed 's/\[at\]/@/g'|bash
@tomoyk
tomoyk / recoverConnection.bat
Last active June 24, 2017 07:11
接続が切れた時に復帰させるためのスクリプト
@echo offf
rem ログ出力も書きたい
rem 変数の宣言
set GATEWAY_IP=10.203.10.x
rem 初期設定
color 1F
title インターネット接続確認
@tomoyk
tomoyk / FileList.bash
Created June 26, 2017 00:25
ls to html
paste <(ls|sed 's/^/<li><a href=\"/g'|sed 's/$/\">/g') <(ls|sed 's|$|</a><\/li>|g')
@tomoyk
tomoyk / croal.bash
Last active August 24, 2017 09:47
URLをクロールする時に役立つワンライナー
curl -s http://hoge.com/ | grep -o "<a [^>]*href=[\"\'][^>]*[\"\']>" \
| ggrep -oP "href=[\"\'].*?[\"\']" \
| sed "s/^href=[\"\']//g" \
| rev | cut -c2- | rev \
| sed 's|^/[^/]|http://hoge.com&|g' \
| sed 's|^//|http:&|g' \
| less
@tomoyk
tomoyk / croal-simple.bash
Created August 24, 2017 11:29
aタグを切り出すシンプルなワンライナー
curl -s http://koyama.me/ | grep -o "<a [^>]*href=[\"\'][^>]\+[\"\' ]>.*</a>" > out.html
@tomoyk
tomoyk / compile.bash
Created September 11, 2017 11:37
Latexでコンパイルするやっつけスクリプト
#!/bin/bash
if [ -f $1 ]
then
echo bash compile.bash [FileName]
exit 1
else
fname=$1
fi
@tomoyk
tomoyk / origin.py
Created October 18, 2017 01:00
クロマキー合成するPythonコード。詳しいことは https://github.com/tomoyk/kokasai17/tree/master/chromaKey へ。
#!/usr/bin/env python
import numpy as np
import cv2
import sys
argv = sys.argv
try:
if argv[1] == "1":
@tomoyk
tomoyk / proc_testVisualizer.pde
Created October 18, 2017 01:03
ドアセンサー移植版のコード。詳しいことは, https://github.com/tomoyk/kokasai17/tree/master/proc_testVisualizer へ。
import processing.sound.*;
import processing.serial.*;
/* Viewer */
boolean status = false; // Now status
boolean before = true; // Before status
PImage closeImg, openImg;
SoundFile hi, bye;
/* Srial */
@tomoyk
tomoyk / CLangCountARGC.txt
Created October 29, 2017 15:14
Cで引数の数を数えるコードを見つけてなるほどと思ったのでメモ。
$
$ cat a.c
#include <stdio.h>
int main(int argc, char *argv[]){
int argCount = 1;
while(argv[argCount]){
argCount++;
@tomoyk
tomoyk / cal-check-degit.py
Created November 27, 2017 05:26
JANのチェックディジットを計算するコード
#!/usr/bin/env python
num=498860100962
even=0
odd=0
for i in range(0, len(str(num))):
if(i%2==0):
odd+= int(num/(10**i))%10
# print("odd:", odd)