Skip to content

Instantly share code, notes, and snippets.

View kowill's full-sized avatar

kowill kowill

  • 06:26 (UTC +09:00)
View GitHub Profile
@kowill
kowill / unattend.xml
Created March 3, 2016 09:15
ひな形。
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<settings pass="offlineServicing">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<ComputerName>NanoServer</ComputerName>
</component>
</settings>
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<UserAccounts>
@kowill
kowill / FbSql.xshd
Last active July 3, 2022 15:29
Firebird 用xshd
<SyntaxDefinition name="SQL" extensions=".sql" xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008">
<Color name="Digits" foreground="#FF00008B" exampleText="3.1415f" />
<Color name="Comment" foreground="#FF008000" exampleText="string text = &quot;Hello, World!&quot;" />
<Color name="Punctuation" foreground="#FFFF0000" exampleText="string text = &quot;Hello, World!&quot;" />
<Color name="String" foreground="#FF808000" exampleText="string text = &quot;Hello, World!&quot;" />
<Color name="String2" foreground="#FF999933" exampleText="string text = &quot;Hello, World!&quot;" />
<Color name="Keyword" foreground="#FF0000FF" fontWeight="bold" exampleText="SELECT" />
<Color name="MethodCall" foreground="#FF191970" fontWeight="bold" />
<Color name="ObjectReference" foreground="#FF008080" exampleText="Customer.Name" />
<Color name="CommentMarkerSetTodo" foreground="#FFFF0000" fontWeight="bold" />
@kowill
kowill / BindableEditor.cs
Last active July 3, 2022 15:28
AvalonEditのTextプロパティをbindableへ
using ICSharpCode.AvalonEdit;
using System;
using System.Windows;
namespace AvalonEditSample
{
public class BindableEditor : TextEditor
{
public BindableEditor()
{

image

@kowill
kowill / DoubleBitString.cs
Last active October 16, 2018 16:18
double → bit string → double
string ToBitDoubleString(double num)
{
return BitConverter.GetBytes(num)
.Reverse() // little endian -> big endian
.SelectMany(x => x.ToString("X2")) //to x16 char
.Select(x => Convert.ToString(Convert.ToInt32($"{x}", 16), 2).PadLeft(4, '0')) // to x2
.Aggregate("", (x, y) => x + y);
}
double ToDouble(string str)
$path = "HKLM:\SYSTEM\CurrentControlSet\Services\i8042prt\Parameters";
Set-ItemProperty -path $path -name "LayerDriver JPN" -type string -value "kbd106.dll"
Set-ItemProperty -path $path -name "OverrideKeyboardIdentifier" -type string -value "PCAT_106KEY"
Set-ItemProperty -path $path -name "OverrideKeyboardSubtype" -type DWord -value 2
Set-ItemProperty -path $path -name "OverrideKeyboardType" -type DWord -value 7
Get-ItemProperty $path
@kowill
kowill / samlple.cs
Created September 12, 2016 13:31
逆ポーランド変換→計算
using System;
using System.Collections.Generic;
namespace Test20160912
{
class Program
{
static void Main(string[] args)
{
var inputs = new[] { "((1 + 4) * (3 + 7) / 5)", "((1 - 7) / (7 - 5)) * 5", "", "1+2" };
@kowill
kowill / DelZoneId.ps1
Created July 8, 2016 07:25
Delete Zone Id
ls | ?{!$_.PSIsContainer} | Unblock-File
@kowill
kowill / sample.cs
Created June 19, 2016 16:11
最大公約数の取得
int GetGcd(int a, int b)
{
if (a < b) return GetGcd(b, a);
int tmp = 0;
do
{
tmp = a % b;
a = b;
b = tmp;
} while (tmp != 0);
@kowill
kowill / Sample.cs
Created May 11, 2016 14:39
10進数→任意の進数
public string ToRadixString(int num, int radix)
{
if (num == 0) return "0";
var list = new List<string>();
var tmp = num;
while (0 < tmp)
{
var digit = tmp % radix;
tmp = tmp / radix;
list.Add(digit.ToString());