Skip to content

Instantly share code, notes, and snippets.

View rkttu's full-sized avatar

Jung Hyun Nam rkttu

View GitHub Profile
@rkttu
rkttu / readme.txt
Last active September 12, 2022 20:28
(Deprecated) Ubuntu 20.04 + WSL 2 + XRDP PulseAudio
# For those of you looking for this GIST: I don't maintain this code anymore. I recommend using WSLg, which is included starting with Windows 11.
# Please refer to https://gist.github.com/CraigCottingham/fad000cc2ec4678203acf62c4ad2ab23 code that forked this GIST.
# Credits
# https://c-nergy.be/blog/?p=13655
# https://askubuntu.com/questions/844245/how-to-compile-latest-pulseaudio-with-webrtc-in-ubuntu-16-04
# https://askubuntu.com/questions/496549/error-you-must-put-some-source-uris-in-your-sources-list
# https://unix.stackexchange.com/questions/65167/enable-udev-and-speex-support-for-pulseaudio
# https://rudd-o.com/linux-and-free-software/how-to-make-pulseaudio-run-once-at-boot-for-all-your-users
@rkttu
rkttu / avgload.ps1
Last active June 6, 2023 09:19
Average Load (1m, 5m, 15m) Display for Windows
# https://github.com/giampaolo/psutil/blob/master/psutil/arch/windows/wmi.c
$LOADAVG_FACTOR_1F = 0.9200444146293232478931553241
$LOADAVG_FACTOR_5F = 0.9834714538216174894737477501
$LOADAVG_FACTOR_15F = 0.9944598480048967508795473394
$SAMPLING_INTERVAL = 5
$load_avg_1m = 0.0;
$load_avg_5m = 0.0;
@rkttu
rkttu / kubectx.ps1
Created January 18, 2020 16:52
PowerShell version of kubectx and kubens
function global:Select-KubeContext {
[CmdletBinding()]
[Alias('kubectx')]
param (
[parameter(Mandatory=$False,Position=0,ValueFromRemainingArguments=$True)]
[Object[]] $Arguments
)
begin {
if ($Arguments.Length -gt 0) {
$ctx = & kubectl.exe config get-contexts -o=name | fzf.exe -q @Arguments
@rkttu
rkttu / tf.ps1
Created January 18, 2020 13:57
Terraform Alias Example
function global:Invoke-Terraform {
[CmdletBinding()]
[Alias('tf')]
param (
[parameter(Mandatory=$False,Position=0,ValueFromRemainingArguments=$True)]
[Object[]] $Arguments
)
begin {
$PrevAwsProfile = $env:AWS_PROFILE; $env:AWS_PROFILE='saml'
}
@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 / Dockerfile
Created December 4, 2019 22:26
IIS Windows Container with STDOUT Logging
FROM mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019
RUN set COMPLUS_NGenProtectedProcess_FeatureEnabled=0 & \
\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen update & \
\Windows\Microsoft.NET\Framework\v4.0.30319\ngen update
ADD https://github.com/microsoft/windows-container-tools/releases/download/v1.0/LogMonitor.exe /LogMonitor/
ADD https://dotnetbinaries.blob.core.windows.net/servicemonitor/2.0.1.3/ServiceMonitor.exe /
RUN powershell.exe -Command Set-WebConfigurationProperty -p 'MACHINE/WEBROOT/APPHOST' -fi 'system.applicationHost/log' -n 'centralLogFileMode' -v 'CentralW3C'; \

Keybase proof

I hereby claim:

  • I am rkttu on github.
  • I am rkttu (https://keybase.io/rkttu) on keybase.
  • I have a public key ASC4angFcEhW26hdDOcrHUYMQBHo5t_aGhg_p2hDEukQkQo

To claim this, I am signing this object:

@rkttu
rkttu / PInvokeTest.ps1
Last active June 6, 2023 09:19
P/Invoke with PowerShell (and small portion of C# code)
# Windows uses msvcrt.dll
Add-Type -Path .\test.cs
[Sample]::printf_win32("Hello, World %d!`r`n", 123)
# *nix uses libc
Add-Type -Path ./test.cs
[Sample]::printf_linux("Hello, World %d!`n", 123)
@rkttu
rkttu / win10_ocr_example.linq
Created October 3, 2019 15:59
Windows 10 OCR Example with LINQPad 6
<Query Kind="Statements">
<NuGetReference>Microsoft.Windows.SDK.Contracts</NuGetReference>
<Namespace>Windows.Globalization</Namespace>
<Namespace>Windows.Graphics.Imaging</Namespace>
<Namespace>Windows.Media.Ocr</Namespace>
<Namespace>Windows.Storage</Namespace>
<Namespace>Windows.Storage.Streams</Namespace>
<Namespace>System.Net.Http</Namespace>
</Query>
@rkttu
rkttu / Program.cs
Created October 3, 2019 03:29
.NET Core 3.0 printf P/Invoke Example
using System;
using System.Runtime.InteropServices;
namespace PInvokeTest
{
class Program
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi, SetLastError = false)]
public delegate int printf_int(string format, int arg0);