Skip to content

Instantly share code, notes, and snippets.

@bonjin6770
bonjin6770 / MyInfo.pas
Last active November 16, 2017 01:25
Delphi ObjectToJsonString
unit MyInfo;
interface
type
TMyInfo = class
private
FName: string;
FAge: integer;
public
@bonjin6770
bonjin6770 / DataSerializerSample.cs
Last active June 22, 2017 01:52
Data Serializer Sample
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Json;
using System.Text;
namespace Sample
{
public static class DataSerializerSample
@bonjin6770
bonjin6770 / Register-ScheduledTask-Sample.ps1
Created April 18, 2017 00:48
Register ScheduledTask by PowerShell Script
# タスクスケジューラにタスクを登録します。
# Register ScheduledTask
# friday,sunday, AP3:00
$Trigger = New-ScheduledTaskTrigger -Weekly -DaysOfWeek Sunday,Friday -At "03:00:00"
# execute sample.exe
$Action = New-SCheduledTaskAction -Execute "D:\sample.exe"
Register-ScheduledTask -TaskPath "\Sample" -TaskName "test" -User "SYSTEM" -RunLevel Highest -Trigger $Trigger -Action $Action
private void MakeIniFile(object sender, EventArgs e)
{
string path = "SAMPLE.ini";
var iniData = new IniData();
iniData.Configuration.AssigmentSpacer = "";
var section = new SectionData("SAMPLE");
iniData.Sections.Add(section);
using (var sw = new StreamWriter(path, false))
{
@bonjin6770
bonjin6770 / read-ini-file-with-Ini-Parser.cs
Created February 9, 2017 00:15
read ini file with Ini-Parser
using IniParser;
using IniParser.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ReadIniFileKey
{
@bonjin6770
bonjin6770 / DeleteDoubleQuote.cs
Created November 10, 2016 01:08
Delete DoubleQuote
public string DeleteDoubleQuote(string value) {
if (value.Substring(0, 1) != @"""") { return value; }
if (value.Substring(value.Length - 1) != @"""") { return value; }
value = value.Substring(1); // 開始位置の「"」を削除
value = value.Remove(value.Length - 1); // 終了位置の「"」を削除
return value;
}
@bonjin6770
bonjin6770 / get-dir-programfiles-on-Windows.bat
Last active August 24, 2016 22:23
Get Directory "Program Files" Folder on Windows OS
@echo off
IF "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
set PROGRAM_FILES="Program Files (x86)"
) ELSE IF "%PROCESSOR_ARCHITECTURE%" == "x86" (
set PROGRAM_FILES="Program Files"
)
echo %PROGRAM_FILES:"=%
pause
@bonjin6770
bonjin6770 / Program.cs
Last active June 13, 2016 13:22
try-execute-csc
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Program
{
class Program
{
@bonjin6770
bonjin6770 / ConvertStringToPAnsiChar.pas
Last active January 5, 2018 09:32
DelphiにおけるStringをPAnsiCharへ安全に変換する
function ConvertStringToPAnsiChar(str:string):PAnsiChar;
var
p:PAnsiChar;
begin
GetMem(p, Length(string) + 1);
System.AnsiStrings.StrPCopy(p, str);
Result := p;
end;
@bonjin6770
bonjin6770 / 0_reuse_code.js
Created March 26, 2014 14:43
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console