Skip to content

Instantly share code, notes, and snippets.

View kohnakagawa's full-sized avatar
🌴
On vacation

tsunekoh kohnakagawa

🌴
On vacation
View GitHub Profile
@kohnakagawa
kohnakagawa / Microsoft.PowerShell_profile.ps1
Created August 25, 2018 15:45
C:\Users\<USERNAME>\Documents\WindowsPowerShell に配置するPowerShellの設定ファイル
Import-Module PSReadLine
Set-PSReadlineOption -EditMode Emacs
function touch {
New-Item -type file $args
}
function g {
cd "$(ghq root)\$(ghq list | peco)"
}
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.neural_network import MLPClassifier
from sklearn.externals import joblib
import pandas as pd
import numpy as np
def main():
# example of MLP
@kohnakagawa
kohnakagawa / kado_maker.py
Created July 4, 2018 12:52
csvから稼働表を作成するためのスクリプト
import openpyxl as opx
import pandas as pd
import datetime as dt
import argparse
TEMPLATE_XLSX = "稼働表テンプレート.xlsx"
REGULAR_CLOSE_TIME = (dt.time(18, 30), dt.time(19, 0))
REST_TIME_REGULAR = dt.timedelta(hours=1)
REST_TIME_OVER = dt.timedelta(hours=1, minutes=30)
@kohnakagawa
kohnakagawa / getEnvDir.cpp
Last active June 10, 2018 03:29
GetCommandLineとGetFullPath利用のサンプルコード
#include <stdio.h>
#include <windows.h>
int main(int argc, char* argv[]) {
const char* str = GetCommandLine();
// GetCommandLineからプログラム名を取得
const char* progNameBeg = strchr(str, (int)'"') + 1;
const char* progNameEnd = strchr(progNameBeg, (int)'"');
const size_t progNameSize = progNameEnd - progNameBeg;
@kohnakagawa
kohnakagawa / run_each.ps1
Last active June 8, 2018 13:37
ディレクトリ配下の実行ファイルをリストアップして実行するためのスクリプト
#requires -Version 2
function execForEach($files, $beg, $end, $unroll) {
$maximumRuntimeSeconds = 3
$procs = @(1..$unroll)
for ($i = $beg; $i -lt $end; $i += $unroll) {
for ($j = 0; $j -lt $unroll; $j++) {
$procs[$j] = Start-Process -NoNewWindow -FilePath $files[$i + $j].FullName -PassThru
}
try {
@kohnakagawa
kohnakagawa / tab2space.sh
Created June 4, 2018 12:48
tabインデントをspaceインデントに変換するコマンド
#!/bin/sh
find ./ -type f -name "*.cpp" -exec sed -i 's/\t/ /g' {} \;
00000000004005f0 <caller>:
4005f0: ff e7 jmp rdi
4005f2: 0f 1f 40 00 nop DWORD PTR [rax+0x0]
4005f6: 66 2e 0f 1f 84 00 00 nop WORD PTR cs:[rax+rax*1+0x0]
4005fd: 00 00 00
0000000000400600 <func>:
400600: 48 83 ec 38 sub rsp,0x38
400604: ba 41 bb ff ff mov edx,0xffffbb41
400609: b9 49 ba ff ff mov ecx,0xffffba49
@kohnakagawa
kohnakagawa / .spacemacs
Created February 24, 2018 15:31
temporary .spacemacs configuration file for mac book air
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
@kohnakagawa
kohnakagawa / sands.ahk
Created February 20, 2018 09:58
SandS for Windows 10 using AutoHotKey
; Edit registry to swap.
; - Space <=> LShift
*~a::
*~b::
*~c::
*~d::
*~e::
*~f::
*~g::
@kohnakagawa
kohnakagawa / density_c.bash
Last active February 20, 2018 02:59
脂質のCの密度分布をCの番号を変化させながら一度に計算するためのスクリプト
#!/bin/bash
export GMX_MAXBACKUP=-1
function print_usage() {
echo "${0} root_dir lipid_name"
exit
}
if [ "$#" -ne 2 ]; then