Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Work from home

Kiyoaki Tsurutani kiyoaki

🏠
Work from home
View GitHub Profile
@kiyoaki
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'
services:
hoge:
image: hogeimage:0.0.1
build:
context: .
dockerfile: hoge/Dockerfile
ports:
- 80:3000
@kiyoaki
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
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.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 Dec 18, 2017
Encode files UTF-8
View EncodeUtf8.ps
$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 = "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 Jun 29, 2017
cloud instance prices monthly JPY
View 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 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)
{