Skip to content

Instantly share code, notes, and snippets.

View nagasato's full-sized avatar

nagasato nagasato

  • NAGANO, Japan
View GitHub Profile
@nagasato
nagasato / StringExtensions.cs
Last active September 19, 2023 14:48
TrimEx method to remove control characters.
using System;
using System.Collections.Generic;
using System.Linq;
namespace StringUtilities
{
/// <summary>
/// StringExtensions
/// </summary>
public static class StringExtensions
@nagasato
nagasato / gist:05b487086541d427c137
Last active August 29, 2015 14:01
listing tables and columns (MS SQL Server)
SELECT objs.name TABLE_NAME, cols.name COLUMN_NAME, cols.is_identity, cols.is_computed FROM Sys.Columns cols
INNER JOIN Sys.objects objs ON (cols.object_id = objs.object_id)
WHERE objs.type = 'U'
ORDER BY objs.name ASC, cols.column_id ASC;
@nagasato
nagasato / 01_icacls_save.bat
Last active December 17, 2015 00:19
Windows 8のユーザープロファイルフォルダ(C:\Users)をD:\Usersに移すためのスクリプト
@echo off
rem 再解析ポイントのACLの保存
C:
cd \
icacls "Users" /L /save D:\Users.dat
cd C:\Users
icacls "All Users" /L /save D:\User-All_Users.dat
icacls "Default User" /L /save D:\User-Default_User.dat
@nagasato
nagasato / gist:2288987
Created April 3, 2012 03:06
Apache2.2: RedirectMatchで、とあるファイル(やディレクトリ)以外にマッチさせる

例: /foo.html以外へのアクセスは http://www.example.com/ にリダイレクトする。

RedirectMatch "^/((?!foo\.html).*)$" http://www.example.com/

例: サイト閉鎖の際にすべてのページへのアクセスに410を返す。410の応答ページはRedirectMachから除外する。

RedirectMatch gone "^/((?!gone\.txt).*)$"
ErrorDocument 410 /gone.txt
@nagasato
nagasato / force_meiryo_font.css
Created December 21, 2011 03:58
CSS: font-family overwrite "Meiryo"
body * { font-family: Meiryo !important; }
/* use browser's monospace font */
pre { font-family: monospace !important; }
@nagasato
nagasato / gmail_monospace_font.css
Last active September 28, 2015 18:58
Gmail monospace font user css.
/* Message body */
div.ii>div {
font-family: monospace !important;
font-size: 100% !important;
line-height: 120% !important;
width: 80ex !important;
}
/* Send form (current version) */
div.At>textarea.Ak {