Skip to content

Instantly share code, notes, and snippets.

View 松屋問題.cs
using System;
using System.Collections.Generic;
using System.Linq;
class Program
class 牛めし
public string 大きさ { get; set; }
public int カロリー { get; set; }
jsakamoto / allow.ps1
Created Jan 26, 2017
Create/Delete Azure Database server firewall rule by Microsoft Azure CLI 2.0 ("az" command)
View allow.ps1
$serverName = "<server name>"
$resourceGroupName = "<resource group name>"
$ruleName = "<rule name>"
$globalIPAddress = curl.exe -s
echo "Global IP Address of this site: $globalIPAddress"
az sql server firewall create --firewall-rule-name $ruleName --server-name $serverName -g $resourceGroupName --start-ip-address $globalIPAddress --end-ip-address $globalIPAddress > $null
az sql server firewall list --server-name $serverName -g $resourceGroupName -o table
jsakamoto / Script1.fsx
Created Nov 10, 2016
Learn F# - mastering “” – decode to ASCII art
View Script1.fsx
let code = "f8f8f8f8f7b2f8f63181f8f5c1318131f8f401318101f8f3c10131810131f8f202318102f8f1c10231810231f803718103f7c10211f1e10331f6810271f28103f5e10211f1b1f1e10331f40371c131f28103f3c10211f10131f2e10331f2810271e10131f38103f1e103f1810131f3c10371f1810211e10131f3810211f2e103f18131f2e10331f3810231e131f28103f4e103f1b1f1e10371f5810231f2810211f6e103f1e10331f7810231810211f8e10231810271f8f1810131810111f8f2e10131810131f8f381318111f8f4c1318171f8f53191f8f7b1f8f8f8f8f07"
let decodeIt (code:string) =
let data =
|> (fun n -> code.Substring(n*2, 2))
|> (fun s -> new String(s.[0], Convert.ToInt32(string s.[1], 16)))
|> Seq.toArray |> (fun a -> String.Join ("", a))
jsakamoto /
Last active Nov 18, 2018
Jasmine による TypeScript/JavaScript 単体テストを実行する環境を作る - karma 編


OS 環境の整備

  1. node.js をインストールしておく (Windows ならここからインストーラをダウンロード)


  1. 作業フォルダ(プロジェクトフォルダ)に移動。
  2. &gt; npm init で作業場所を準備、package.json を生成。
jsakamoto / .gitignore
Last active Sep 2, 2016
オレの gulp
View .gitignore
jsakamoto / RestoreContextMenuZip.bat
Last active Jul 27, 2016
View RestoreContextMenuZip.bat
@echo off
rem [注意] 日本語含んでいるので、SHIFT-JIS エンコードでこのバッチファイルを作成すること。
openfiles > NUL 2>&1
if NOT %ERRORLEVEL% EQU 0 goto NotAdmin
reg add HKCR\.zip /f /ve /d "CompressedFolder" > NUL
reg add HKCR\.zip /f /v "Content Type" /t REG_SZ /d "application/x-zip-compressed" > NUL
reg add HKCR\.zip /f /v "DontCompressInPackage" /t REG_SZ /d "" > NUL
reg add HKCR\.zip /f /v "PerceivedType" /t REG_SZ /d "compressed" > NUL
reg add HKCR\.zip\OpenWithProgids /f /v "CompressedFolder" /t REG_SZ /d "" > NUL
jsakamoto / pre-build.bat
Created Jul 20, 2016
pre-build script for create "custom.appSettings.config"
View pre-build.bat
if exist "$(ProjectDir)custom.appSettings.config" goto SKIP
echo ^<?xml version="1.0" encoding="utf-8" ?^> > "$(ProjectDir)custom.appSettings.config"
echo ^<appSettings^> >> "$(ProjectDir)custom.appSettings.config"
echo ^<add key="(key)" value="(value)"/^> >> "$(ProjectDir)custom.appSettings.config"
echo ^</appSettings^> >> "$(ProjectDir)custom.appSettings.config"
jsakamoto / ExceptionLoggerTraceRedirector.cs
Created Dec 25, 2015
How to logging unhandled exceptions in ASP.NET Web API 2 running on Azure Web Apps
View ExceptionLoggerTraceRedirector.cs
public class ExceptionLoggerTraceRedirector : ExceptionLogger
public override void Log(ExceptionLoggerContext context)
var logtext = new StringBuilder();
logtext.AppendLine($"Request: {context.Request}").AppendLine();
logtext.AppendLine($"Exception: {context.Exception}");
View 今日の日付のフォルダを作る.ps1
# LICENSE - [The Unlicense](
cd (Split-Path ( & { $myInvocation.ScriptName } ) -Parent)
$now = [DateTime]::Now
for ($counter = 1; ; $counter++) {
$dirName = "{0:yyyy-MM-dd}-{1:D3}" -f $now, $counter
if (-not (Test-Path $dirName)) {
md $dirName > $null
jsakamoto / .ps1
Last active Dec 22, 2015
Enable .ps1 file in "New" items on Windows Explorer folder context menu.
View .ps1
# Enable .ps1 file in "New" items on Windows Explorer folder context menu.
# LICENSE - [The Unlicense](
New-PSDrive -name HKCR -PSProvider Registry -root HKEY_CLASSES_ROOT
New-Item HKCR:\.ps1\ShellNew
New-ItemProperty HKCR:\.ps1\ShellNew NullFile -propertyType String