Skip to content

Instantly share code, notes, and snippets.

View rkttu's full-sized avatar

Jung Hyun Nam rkttu

View GitHub Profile
@rkttu
rkttu / Dockerfile
Last active April 28, 2022 14:27
Running ASP.NET Web API in Windows Container with LINQPad 7
FROM mcr.microsoft.com/dotnet/sdk:6.0-windowsservercore-ltsc2022 AS build
RUN powershell.exe -Command \
Invoke-WebRequest -UseBasicParsing 'https://www.linqpad.net/GetFile.aspx?LINQPad7Setup.exe' -OutFile "$home/LINQPad7Setup.exe"; \
Start-Process -FilePath "$home/LINQPad7Setup.exe" -ArgumentList "/SP-","/VERYSILENT","/SUPPRESSMSGBOXES","/NORESTART","/NOICONS" -NoNewWindow -Wait; \
rm -Force "$home/LINQPad7Setup.exe"; && \
setx.exe /M PATH "%PROGRAMFILES%\LINQPad7;%PATH%"
FROM build
@rkttu
rkttu / Dockerfile
Created April 28, 2022 14:03
LINQPad runner running on Windows Container
FROM mcr.microsoft.com/dotnet/sdk:6.0-windowsservercore-ltsc2022 AS build
RUN powershell.exe -Command \
Invoke-WebRequest -UseBasicParsing 'https://www.linqpad.net/GetFile.aspx?LINQPad7Setup.exe' -OutFile "$home/LINQPad7Setup.exe"; \
Start-Process -FilePath "$home/LINQPad7Setup.exe" -ArgumentList "/SP-","/VERYSILENT","/SUPPRESSMSGBOXES","/NORESTART","/NOICONS" -NoNewWindow -Wait; \
rm -Force "$home/LINQPad7Setup.exe"; && \
setx.exe /M PATH "%PROGRAMFILES%\LINQPad7;%PATH%"
FROM build
@rkttu
rkttu / ConvertTo-AnimatedGif.ps1
Created October 28, 2021 01:58
Animated GIF conversion PowerShell function
function ConvertTo-AnimatedGif {
param (
[string]$VideoFilePath = $(Read-Host -Prompt 'Enter a video file path.'),
[int]$FramePerSeconds = 10,
[int]$Scale = 320,
[switch]$Verbose
)
$ffmpegCommand = (Get-Command -ErrorAction Ignore 'ffmpeg.exe')
@rkttu
rkttu / create_selfsigned_codesign.cmd
Created July 9, 2021 08:11
Self-signed Code Sign Certificate Generator
@echo off
pushd "%~dp0"
REM Please run this batch script inside Windows SDK or Visual Studio command prompt.
SET CN=MyCN
if exist CA.cer (
certutil.exe -user -delstore Root CA.cer
del /f CA.cer
@rkttu
rkttu / CTest.cpp
Last active November 10, 2022 09:13
C++/CLI and C# Interop Sample - For Complete Source Code, Go to https://github.com/level120/CsharpCppSample
#include "pch.h"
#include "CTest.h"
using System::Runtime::InteropServices::Marshal;
CTest::CTest()
{
this->pVaListener = new CVaListenerUnmanaged();
this->pVaListenerManaged = gcnew CVaListenerManaged();
}
@rkttu
rkttu / CSharp Sample.ipynb
Created November 21, 2020 10:08
닷넷 인터랙티브 기반 C# 기초 강좌 샘플
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rkttu
rkttu / docker2wsl.cmd
Created October 25, 2020 16:50
Docker container to WSL convert
@echo off
pushd "%~dp0"
rem Example: docker2wsl ubuntu:latest myubuntu
docker pull %1
docker run -d --name %2 %1 /bin/sh > %TEMP%\ctrid.txt
set /p CTRID= < %TEMP%\ctrid.txt
if exist %TEMP%\ctrid.txt del /f /q %TEMP%\ctrid.txt
@rkttu
rkttu / README.md
Last active November 7, 2020 04:57
KCD 2020 Online Code Sample {WSLHUB]

프로그래밍 방식으로 WSL 배포판 안의 사용자를 조회하는 방법

이 코드 샘플은 프로그래밍 방식으로 WSL 배포판 안의 사용자를 조회할 수 있는 방법을 설명합니다. Win32 API를 주로 사용하였고, 일부 편의를 위하여 C# 코드를 이용했지만, C++ 코드에서도 같은 기능을 구현할 수 있습니다.

프로그램 코드를 테스트해보기 위해서는 .NET 5 이상의 SDK를 설치해야 합니다. 그 다음, 이 Gist 리포지터리를 Git으로 체크아웃하고 dotnet run 명령으로 실행해봅니다.

@rkttu
rkttu / main.cpp
Created September 29, 2020 07:48
Jagged String Array (VC++) Sample
#include <tchar.h>
#include <stdio.h>
#include <combaseapi.h>
int __stdcall GetStringArrayDataW(OUT LPWSTR** lpArrayDest, OUT SIZE_T* pArrayLength);
void __stdcall FreeStringArrayW(OUT LPWSTR** lpArrayDest, IN SIZE_T nArrayLength);
int __stdcall GetStringArrayDataA(OUT LPSTR** lpArrayDest, OUT SIZE_T* pArrayLength);
void __stdcall FreeStringArrayA(OUT LPSTR** lpArrayDest, IN SIZE_T nArrayLength);
@rkttu
rkttu / wslhub-cla.md
Last active July 7, 2022 15:14
WslHub Contributor License Agreement

Contributor License Agreement

The following terms are used throughout this agreement:

  • You - the person or legal entity including its affiliates asked to accept this agreement. An affiliate is any entity that controls or is controlled by the legal entity, or is under common control with it.
  • Project - is an umbrella term that refers to any and all the WSLHUB open source projects.
  • Contribution - any type of work that is submitted to a Project, including any modifications or additions to existing work.
  • Submitted - conveyed to a Project via a pull request, commit, issue, or any form of electronic, written, or verbal communication with WSLHUB contributors or maintainers.

1. Grant of Copyright License.