Skip to content

Instantly share code, notes, and snippets.

View zkan's full-sized avatar
🐻
Stay Hungry. Stay Foolish.

Kan Ouivirach zkan

🐻
Stay Hungry. Stay Foolish.
View GitHub Profile
@zkan
zkan / demo_schema.rb
Created January 22, 2026 09:57
Demo on how Active Record in Rails works
SCHEMA = {
users: [:id, :email, :name]
}
class MiniRecord
def self.columns
table = (self.name.downcase + "s").to_sym
SCHEMA[table]
end
@zkan
zkan / Uptime-Kuma-Status-Page-Dark-Mode-High-Density-Tweaks.css
Created July 16, 2025 05:11 — forked from brooksvb/Uptime-Kuma-Status-Page-Dark-Mode-High-Density-Tweaks.css
These CSS tweaks are for higher density display for Uptime Kuma status pages in dark mode.
:root {
--min-item-width: 28ch;
--max-item-width: .5fr;
--grid-spacing: .25rem;
--item-padding: .25rem;
}
/* Let items expand on small screens */
@media (max-width: 600px) {
:root {

Vim Manipulation Cheat Sheet

Action

Key Result
v select
y copy (yank)
c change
d delete
@zkan
zkan / linux-setup.sh
Created June 5, 2024 06:18 — forked from dhh/linux-setup.sh
linux-setup.sh
# Libraries and infrastructure
sudo apt update -y
sudo apt install -y \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev mupdf mupdf-tools \
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \
rbenv apache2-utils
@zkan
zkan / mongodb_shell_commands.md
Created March 29, 2023 04:53 — forked from michaeltreat/mongodb_shell_commands.md
Quick Cheat Sheet for Mongo DB Shell commands.

MongoDB Shell Commands Cheat Sheet.

This is a Cheat Sheet for interacting with the Mongo Shell ( mongo on your command line). This is for MongoDB Community Edition.

Preface:

Mongo Manual can help you with getting started using the Shell.

FAQ for MongoDB Fundamentals and other FAQs can be found in the side-bar after visiting that link.

@zkan
zkan / kickstarter_sql_style_guide.md
Created November 15, 2022 15:16 — forked from fredbenenson/kickstarter_sql_style_guide.md
Kickstarter SQL Style Guide
layout title description tags
default
SQL Style Guide
A guide to writing clean, clear, and consistent SQL.
data
process

Purpose

@zkan
zkan / duckdb_bq_storage_api.py
Created July 8, 2022 11:06 — forked from ML-engineer/duckdb_bq_storage_api.py
Read BQ table to DuckDB directly from storage read api
import duckdb
from google.cloud import bigquery
bqclient = bigquery.Client()
table = bigquery.TableReference.from_string(
"bigquery-public-data.utility_us.country_code_iso"
)
rows = bqclient.list_rows(table)
country_code_iso = rows.to_arrow(create_bqstorage_client=True)
cursor = duckdb.connect()
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject"
],
@zkan
zkan / Dockerfile
Created February 5, 2022 10:03 — forked from jitsejan/Dockerfile
PySpark, Docker and S3
FROM jupyter/pyspark-notebook
USER root
# Add essential packages
RUN apt-get update && apt-get install -y build-essential curl git gnupg2 nano apt-transport-https software-properties-common
# Set locale
RUN apt-get update && apt-get install -y locales \
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
&& locale-gen
# Add config to Jupyter notebook
COPY jupyter/jupyter_notebook_config.py /home/jovyan/.jupyter/
@zkan
zkan / airflow-s3-connection
Created September 26, 2021 11:18 — forked from hyperleex/airflow-s3-connection
amazon s3 / minio s3 airflow connection
admin > connections > +
conn_type = s3
conn_name = local_minio
Extra: a JSON object with the following properties:
{
"aws_access_key_id":"your_minio_access_key",
"aws_secret_access_key": "your_minio_secret_key",
"host": "http://127.0.0.1:9000"