Skip to content

Instantly share code, notes, and snippets.

@jsakamoto
jsakamoto / My-default-head-tag.html
Last active January 22, 2016 12:35
my default meta tag
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# article: http://ogp.me/ns/article#">
<meta name="viewport" content="width=device-width" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="twitter:card" content="summary">
<meta property="og:title" content="{TITLE}" />
<meta property="og:description" content="{DESCRIPTION}" />
<meta property="og:url" content="@Url.AppUrl()" />
<meta property="og:image" content="@Url.AppUrl()/Content/images/ogpimage.png" /><!-- The size of ogpimage.png is 120px x 120px. -->
<meta name="keywords" content="{KEYWORDS}" />
<meta name="description" content="{DESCRIPTION}" />
import webbrowser
import SimpleHTTPServer
import thread
import time
import urllib
from zipfile import ZipFile
import os
tagname = "1.0"
zipname = "markdown-presenter-" + tagname + ".zip"
@jsakamoto
jsakamoto / _.bat
Last active December 27, 2015 18:19
@powershell -nop -ex unrestricted -c "iex ((new-object net.webclient).DownloadString('http://goo.gl/2JUSZU'))"
@jsakamoto
jsakamoto / ExceptionLoggerTraceRedirector.cs
Created December 25, 2015 02:05
How to logging unhandled exceptions in ASP.NET Web API 2 running on Azure Web Apps
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}");
Trace.TraceError(logtext.ToString());
}
}
# LICENSE - [The Unlicense](http://unlicense.org/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
break;
}
@jsakamoto
jsakamoto / .ps1
Last active December 22, 2015 22:57
Enable .ps1 file in "New" items on Windows Explorer folder context menu.
# Enable .ps1 file in "New" items on Windows Explorer folder context menu.
# LICENSE - [The Unlicense](http://unlicense.org/UNLICENSE)
New-PSDrive -name HKCR -PSProvider Registry -root HKEY_CLASSES_ROOT
New-Item HKCR:\.ps1\ShellNew
New-ItemProperty HKCR:\.ps1\ShellNew NullFile -propertyType String
@jsakamoto
jsakamoto / index.html
Created September 10, 2013 23:27
Study of CSS transition animation.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<link href="style.css" rel="stylesheet" />
</head>
<body>
<div class="demo">
<div class="text1">This is Text1.</div>
<div class="text2">This is Text2.</div>
document.write('(under construction...)');
@jsakamoto
jsakamoto / code2013-kingyobachi-banner.html
Created June 26, 2013 12:32
Code 2013 きんぎょばち ~ teach me / teach you ~ テーマ募集バナー
<a id="code2013-kingyobachi-banner" href="http://codejapan.jp/2013/kingyobachi" target="_blank" style="display:inline-block">
<img src="http://codejapan.jp/images/code2013/info-kingyobachi.jpg" title="きんぎょばち ~ teach me / teach you ~ テーマ募集中!!" style="border:none"/>
</a>
@jsakamoto
jsakamoto / x.cs
Last active December 17, 2015 01:59
if (args.Length == 2 && args[1] == "-f")
{
sha1(File.ReadAllBytes(args[2]));
}
else if (args.Length == 1)
{
sha1(Encoding.ASCII.GetBytes(args[1]));
}
else if (args.Length == 0)
{