Skip to content

Instantly share code, notes, and snippets.

Work from home

Kiyoaki Tsurutani kiyoaki

Work from home
View GitHub Profile
kiyoaki / webp.bat
Created Apr 11, 2019
webp generator bat file for windows
View webp.bat
@echo off
for /f "delims=" %%i in ('dir /a-d/b/s *.png *.jpg') do cwebp -q 80 "%%i" -o "%%~pi%%~ni.webp"
pause >nul
View docker-compose-mssql-linux.yml
version: '3.4'
image: hogeimage:0.0.1
context: .
dockerfile: hoge/Dockerfile
- 80:3000
kiyoaki / MessagePack-CSharp-Unity.bat
Created Aug 17, 2018
MessagePack-CSharp for Unity, code generation and copy cs files
View MessagePack-CSharp-Unity.bat
cd "$(ProjectDir)"
xcopy /y "$(ProjectDir)*.cs" "{destination}"
mpc.exe -i "$(ProjectPath)" -o "{destination}\MessagePackGenerated.cs"
kiyoaki / bitflyer-realtime-api.js
Last active Feb 9, 2018
bitFlyer Realtime API sample code
View bitflyer-realtime-api.js
var script = document.createElement('script');
script.onload = function() {
var pubnub = new PubNub({
subscribeKey: "sub-c-52a9ab50-291b-11e5-baaa-0619f8945a4f",
publishKey: "nopublishkey",
ssl: true
kiyoaki /
Created Dec 18, 2017
Encode files UTF-8
$dir = "target directory"
Get-ChildItem $dir -Recurse -Include *.cs | Rename-Item -NewName {$_.FullName + ".bkup"}
Get-ChildItem $dir -Recurse -Include *.cs.bkup | ForEach-Object {Get-Content $_.FullName | Out-File -Encoding UTF8 ($_.FullName -replace '.bkup','')}
Get-ChildItem $dir -Recurse -Include *.cs.bkup | del
Get-ChildItem $dir -Recurse -Include *.cshtml | Rename-Item -NewName {$_.FullName + ".bkup"}
Get-ChildItem $dir -Recurse -Include *.cshtml.bkup | ForEach-Object {Get-Content $_.FullName | Out-File -Encoding UTF8 ($_.FullName -replace '.bkup','')}
Get-ChildItem $dir -Recurse -Include *.cshtml.bkup | del
View puppeteer-crawler.js
const puppeteer = require("puppeteer");
const sendgrid = require("sendgrid").mail;
const sendgridApiKey = process.env.SENDGRID_API_KEY;
const fromEmail = "";
const toEmail = "";
const targetUrl = "";
puppeteer.launch().then(async browser => {
try {
const page = await browser.newPage();
kiyoaki / cloud-instance-prices-monthly-JPY
Last active Jun 29, 2017
cloud instance prices monthly JPY
View cloud-instance-prices-monthly-JPY
$("").each(function(i,e){var s=$($(e)[0]).text(); if(s.includes("$")){var v=s.replace(/[^0-9^\.]/g,"")*24*30*112;$(e).text(s+" | 月額 "+v.toFixed(0)+"円");}});
# Azure
$("span.price-data ").each(function(i,e){var s=$($(e)[0]).text(); var v=s.replace(/[^0-9^\.]/g,"")*24*30;$(e).text(s+" | 月額 "+v.toFixed(0)+"円");});
kiyoaki / windows-docker-commands
Last active Jun 29, 2017
Windows docker commands
View windows-docker-commands
# stop all containers
FOR /f "tokens=*" %i IN ('docker ps -a -q') DO docker stop %i
# delete all containers
FOR /f "tokens=*" %i IN ('docker ps -a -q') DO docker rm %i
# delete all images
FOR /f "tokens=*" %i IN ('docker images -a -q') DO docker rmi -f %i
View TechnicalAnalysisFormula.cs
using System;
using System.Collections.Generic;
using System.Linq;
public static class TechnicalAnalysisFormula
public static double Rsi(double[] source, int period)
if (source == null) throw new ArgumentNullException(nameof(source));
if (source.Length <= period) throw new ArgumentException(nameof(source) + ".Length <= period");
View HtmlHelperExtensions.cs
using System;
using System.Linq;
using System.Web.Mvc;
namespace SampleApp.Helpers
public static class HtmlHelperExtensions
public static SelectListItem[] Months(this HtmlHelper htmlHelper, DateTime from, DateTime to, DateTime selected)