Skip to content

Instantly share code, notes, and snippets.

View kowill's full-sized avatar

kowill kowill

  • 14:15 (UTC +09:00)
View GitHub Profile
$Dst = "F:\tmp"
$TargetDrive = "I"
cd $Dst
#mkdir TP4ISOから
Copy-Item ($TargetDrive + ":\NanoServer") NanoServer -Recurse
cd NanoServer
mkdir dism
Copy-Item ($TargetDrive + ":\sources\api*downlevel*.dll") dism
Copy-Item ($TargetDrive + ":\sources\dism*") dism
@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>
$ServerName = (Get-Date -Format "yyMMddHHmmss") + "_Ns"
$Ram = 1024MB
$VhdSize = 40GB
$VhdLocation = "F:\vhd"
$Network = "HypervNet"
$ImagePath = "F:\tmp\NanoServer"
mkdir $VhdLocation\$ServerName\vhd\
@kowill
kowill / ToHex.cs
Created November 7, 2015 02:32
文字コードへ変換。
Func<string, string> toHex = x =>
{
var sb = new StringBuilder();
foreach (char c in x)
{
int intValue = Convert.ToInt32(c);
sb.AppendFormat(" {0:X2}", intValue);
}
return sb.ToString().TrimStart(' ');
};
@kowill
kowill / program.cs
Created October 9, 2015 05:33
今更lzh。必要に迫られてメモ。
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace Sample {
class Program {
static void Main(string[] args) {
Lzh.CompressFile(@"D:\work\test\Hoge.exe", @"D:\work\fuga.lzh");
Lzh.CompressFolder(@"D:\work\test1\", @"D:\work\test1.lzh");
Lzh.Extract(@"D:\work\fuga.lzh", @"D:\work\hoge");
@kowill
kowill / FirebirdTest.program.cs
Created September 25, 2015 08:44
所用でFirebirdの確認用に作成。やり方的には良くないと思ってる。
using FirebirdSql.Data.FirebirdClient;
using System;
namespace FireBirdTest {
class Program {
static int Main(string[] args) {
int i = 0;
int max = args.Length < 1 ? 1 : int.Parse(args[0]);
while (i < max) {
var connectionBuilder = new FbConnectionStringBuilder();
@kowill
kowill / Test.dpr
Created September 25, 2015 08:26
Delphi作成のDLLをC#からCallのテスト
library Test;
uses
System.SysUtils,
System.Classes;
{$R *.res}
function Test1: Integer; stdcall;
begin
@kowill
kowill / Program.cs
Created September 22, 2015 23:54
XmlReaderでDTD読み込み
using System.IO;
using System.Linq;
using System.Reflection;
using System.Xml;
using System.Xml.Linq;
namespace DtdSample
{
class Program
{
@kowill
kowill / foreignkeys.sql
Created September 17, 2015 11:54
外部キー一覧
SELECT
name, OBJECT_NAME(parent_object_id) parent, OBJECT_NAME(referenced_object_id) referenced, delete_referential_action_desc asction
FROM sys.foreign_keys
order by referenced
@kowill
kowill / StringExtension.cs
Created September 14, 2015 00:49
アッパーキャメルケース ←→ スネークケース
using System;
using System.Linq;
namespace Sample {
public static class StringExtensions {
/// <summary>
/// スネークケースをアッパーキャメル(パスカル)ケースに変換
/// 例) sample_hoge_string → SampleHogeString
/// </summary>
public static string SnakeToUpperCamel(this string str) {