Skip to content

Instantly share code, notes, and snippets.

View yht's full-sized avatar
🎯
Focusing

Yudha Ha Te yht

🎯
Focusing
View GitHub Profile
@yht
yht / postgres_json.sql
Created May 5, 2026 10:30
PostgreSQL JSON
-- ambil dari toko - buah - 1 - berat
with src (
SELECT
'{"store":{"fruit":[{"weight":8,"type":"apple"},
{"weight":9,"type":"pear"}]}}' AS src_json
)
SELECT
(src_json::jsonb -> 'store' -> 'fruit' -> 1 ->> 'weight')::int AS store_fruit_1_weight
FROM src;
-- atau
@yht
yht / postgres_xml.sql
Created May 5, 2026 09:51
PostgreSQL XML
-- Fungsi xpath
xpath(path, xml_text)
-- examples: array
select xpath('/a', '<a><b>b1</b><b>b2</b></a>');
select xpath('/a/*', '<a><b>b1</b><b>b2</b></a>');
select xpath('/a/*/text()', '<a><b>b1</b><b>b2</b></a>');
-- pecah row
select unnest(xpath('/a/*/text()', '<a><b>b1</b><b>b2</b></a>'))::text;
-- atribut
@yht
yht / CVE-2026-31431.md
Last active May 4, 2026 02:41
CVE-2026-31431 — Copy Fail: Linux Local Privilege Escalation

Severity: Critical
Affected: Semua distro Linux dengan kernel sejak 2017 (Ubuntu, Debian, RHEL, Amazon Linux, SUSE, dll.)
Referensi: xint.io/blog/copy-fail-linux-distributions

Ringkasan

Bug logika di kernel Linux pada crypto template authencesn. Unprivileged local user dapat memicu 4-byte write terkontrol ke page cache file apapun yang bisa dibaca — termasuk setuid binary seperti /usr/bin/su — dan mendapatkan root shell.

Yang membuatnya berbahaya:

  • Tidak membutuhkan race condition — straight-line exploit, deterministik
@yht
yht / install.sh
Created April 1, 2026 07:29
Install Docker
sudo apt remove $(dpkg --get-selections docker.io docker-compose docker-doc podman-docker containerd runc | cut -f1)
# Add Docker's official GPG key:
sudo apt update
sudo apt install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
@yht
yht / Kitchen_.bat
Created May 17, 2021 09:20
Kettle Pan & Kitchen Template
@echo off
SET JAVA_HOME=C:\Program Files\Java\jre1.8.0_281
SET PATH=%PATH%:%JAVA_HOME%\bin
SET TGL=%DATE:~-4%%DATE:~3,2%%DATE:~0,2%
SET JAM=%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%
SET KTR_DIR=C:\OnGoing\
Kitchen.bat /norep /file=%KTR_DIR%\Test.kjb /logfile=%KTR_DIR%\logs\Test_%TGL%_%JAM%.log
@yht
yht / compile-r.sh
Created June 15, 2020 04:01
Compile R and Build Desktop RStudio Env based on compiled R
#!/bin/bash
cd ~/R/C
wget -c https://cran.r-project.org/src/base/R-4/R-$1.tar.gz
tar xf R-$1.tar.gz
cd R-$1
./configure --prefix=$HOME/Aplikasi/R-$1 \
--enable-R-shlib=yes --with-blas=yes --with-lapack=yes \
--with-x=no --with-readline=no
make
make check
# Library
#########
library(quantmod)
# Get Stock Daily
#################
getSymbols.google("IDX:TLKM", env=globalenv(),
from="2005-04-01")
# Some Setup
@yht
yht / Output.txt
Last active May 9, 2017 05:38
Loop Time Test
R version 3.3.3 (2017-03-06) -- "Another Canoe"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
@yht
yht / RGtk2-Sample.R
Last active February 18, 2017 05:50
Sample Apllication on Journal of Statistical Software Issue 8, Volume 37, December 2010. RGtk2: A Graphical User Interface Toolkit for R.
library(RGtk2)
mainWin <- gtkWindowNew(show = FALSE)
mainWin["title"] <- "Data Sheet"
mainWin$setDefaultSize(600,600)
cbOpen <- function(widget, window) {
dialog <- gtkFileChooserDialog("Choose file", window, "open", "gtk-cancel",
GtkResponseType["cancel"], "gtk-open",
GtkResponseType["accept"])
@yht
yht / odbc.sh
Created November 16, 2016 10:29
ImpalaODBC Pre-Load
#!/bin/bash
# /etc/profile.d/
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libodbcinst.so
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu/odbc
export ODBCINI=$HOME/.odbc.ini
export ODBCSYSINI=/etc
export CLOUDERAIMPALAINI=/opt/cloudera/impalaodbc/lib/64/cloudera.impalaodbc.ini