Skip to content

Instantly share code, notes, and snippets.

View rkttu's full-sized avatar

Jung Hyun Nam rkttu

View GitHub Profile
@rkttu
rkttu / .bashrc
Last active May 7, 2024 05:10
How to initialize oh-my-posh with bash (macOS), bash (WSL, Ubuntu), cmd, zsh and pwsh
# for bash (macOS)
POSH_THEMES_PATH=$(brew --prefix oh-my-posh)/themes
eval "$(oh-my-posh completion bash)"
eval "$(oh-my-posh init bash --config "$POSH_THEMES_PATH"/clean-detailed.omp.json | sed 's|\[\[ -v MC_SID \]\]|[[ -n "$MC_SID" ]]|')"
@rkttu
rkttu / azure-packer-like-demo.linq
Last active April 29, 2024 05:39
Create Azure Windows VM, Connect WinRM, RDP with LINQPad (Demo)
/*
After running as administrator
- Entering the "winrm quickconfig" command if this is your first time setting up winrm
- If you get an error message that says it failed because your network profile is set to public, that's okay.
- To allow all external connections, run "winrm s winrm/config/client @{TrustedHosts="*"}" command
- After you're done testing, run the "winrm s winrm/config/client @{TrustedHosts=""}" command
*/
var credential = default(TokenCredential);
@rkttu
rkttu / EncDecTest.cs
Created April 9, 2024 14:51
RDP Password Embedding Sample
using System;
using System.Security.Cryptography;
// Original Source Code: https://github.com/RedAndBlueEraser/rdp-file-password-encryptor
// System.Security.dll required
public static class Program
{
public static void Main()
{
@rkttu
rkttu / Program.cs
Last active April 5, 2024 22:34
GPT Prompt Builder
using System;
using System.Globalization;
public static class Program
{
private static void Main()
{
var prompt = string.Empty;
prompt = Prompt
@rkttu
rkttu / Dockerfile
Last active April 2, 2024 08:10
Run Office 2019 in Windows Full Container (19H1)
FROM mcr.microsoft.com/windows:1903 AS build
WORKDIR C:\\odtsetup
ADD https://download.microsoft.com/download/2/7/A/27AF1BE6-DD20-4CB4-B154-EBAB8A7D4A7E/officedeploymenttool_11617-33601.exe odtsetup.exe
RUN odtsetup.exe /quiet /norestart /extract:C:\\odtsetup
FROM mcr.microsoft.com/windows:1903 AS download
WORKDIR C:\\odtsetup
COPY --from=build C:\\odtsetup\\setup.exe .
@rkttu
rkttu / Build.cmd
Last active March 25, 2024 08:25
Windows NT Service Containerisation Examples
@echo off
pushd "%~dp0"
%windir%\Microsoft.NET\Framework64\v4.0.30319\csc.exe /nologo /target:exe /r:System.ServiceProcess.dll /out:ServiceMain.exe ServiceMain.cs
%windir%\Microsoft.NET\Framework64\v4.0.30319\csc.exe /nologo /target:exe /out:SimpleMain.exe SimpleMain.cs
:exit
popd
@echo on
@rkttu
rkttu / Program.cs
Created November 15, 2023 05:31
macOS wchar_t P/Invoke Sample
// Require unsafe configuration.
using System.Runtime.InteropServices;
using System.Text;
namespace HelloWorld;
internal partial class NativeMethods
{
// https://github.com/mono/mono/issues/9362
@rkttu
rkttu / kustomization.yaml
Created January 6, 2020 12:03
Deploy WordPress in K3S Cluster (based on Kubernetes Official Documentation)
secretGenerator:
- name: mysql-pass
literals:
- password=YOUR_PASSWORD_HERE
resources:
- mysql-deployment.yaml
- wordpress-deployment.yaml
@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 / ReceiptScanner.cs
Created October 15, 2017 16:48
Receipt Scanner OpenCV C#
using OpenCvSharp;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using static OpenCvSharp.Cv2;
using static System.Math;
namespace ReceiptScannerCSharp
{