Skip to content

Instantly share code, notes, and snippets.

View kiyoaki's full-sized avatar
🏠
Work from home

Kiyoaki Tsurutani kiyoaki

🏠
Work from home
View GitHub Profile
@kiyoaki
kiyoaki / webp.bat
Created April 11, 2019 08:51
webp generator bat file for windows
@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
version: '3.4'
services:
hoge:
image: hogeimage:0.0.1
build:
context: .
dockerfile: hoge/Dockerfile
ports:
- 80:3000
@kiyoaki
kiyoaki / MessagePack-CSharp-Unity.bat
Created August 17, 2018 09:39
MessagePack-CSharp for Unity, code generation and copy cs files
cd "$(ProjectDir)"
xcopy /y "$(ProjectDir)*.cs" "{destination}"
mpc.exe -i "$(ProjectPath)" -o "{destination}\MessagePackGenerated.cs"
@kiyoaki
kiyoaki / bitflyer-realtime-api.js
Last active February 9, 2018 02:20
bitFlyer Realtime API sample code
var script = document.createElement('script');
script.src='https://cdn.pubnub.com/sdk/javascript/pubnub.4.20.1.min.js';
script.onload = function() {
var pubnub = new PubNub({
subscribeKey: "sub-c-52a9ab50-291b-11e5-baaa-0619f8945a4f",
publishKey: "nopublishkey",
ssl: true
})
pubnub.addListener({
@kiyoaki
kiyoaki / EncodeUtf8.ps
Created December 18, 2017 02:52
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
@kiyoaki
kiyoaki / puppeteer-crawler.js
Created November 2, 2017 04:00
puppeteer sample
const puppeteer = require("puppeteer");
const sendgrid = require("sendgrid").mail;
const sendgridApiKey = process.env.SENDGRID_API_KEY;
const fromEmail = "noreply@example.com";
const toEmail = "to@example.com";
const targetUrl = "https://example.com";
puppeteer.launch().then(async browser => {
try {
const page = await browser.newPage();
@kiyoaki
kiyoaki / cloud-instance-prices-monthly-JPY
Last active June 29, 2017 06:02
cloud instance prices monthly JPY
# AWS
http://qiita.com/yuroyoro/items/08cded7662cf494d53f2
# GCP
$("td.ng-isolate-scope").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
kiyoaki / windows-docker-commands
Last active June 29, 2017 05:22
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
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");
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)
{