Skip to content

Instantly share code, notes, and snippets.

View bagustris's full-sized avatar
💭
I may be slow to respond.

Bagus Tris Atmaja bagustris

💭
I may be slow to respond.
View GitHub Profile
@bagustris
bagustris / stereo2mono.py
Created November 25, 2022 01:05
Convert given directory containing stereo files to mono files
#!/usr/bin/env python3
import os
import argparse
import glob
from pydub import AudioSegment
def stereo2mono(files):
"""Convert all files from stereo to mono.
Note: this would effectively also create a copy of files that were already in a mono format
Parameters
import numpy as np
import pandas as pd
import torch
from sklearn.metrics import (
accuracy_score,
balanced_accuracy_score,
f1_score,
roc_auc_score,
)
@bagustris
bagustris / conventional-commits-cheatsheet.md
Created November 26, 2024 09:48 — forked from qoomon/conventional-commits-cheatsheet.md
Conventional Commits Cheatsheet

Conventional Commit Messages starline

See how a minor change to your commit message style can make a difference.

Tip

Have a look at git-conventional-commits , a CLI util to ensure these conventions, determine version and generate changelogs

Commit Message Formats

Default

#!/bin/bash
# VPN connect script - fixes stale connections after WiFi change
# Usage: ./vpn.sh
# Please change OVPN_CONFIG and VPN_PASS
OVPN_CONFIG="./client.ovpn"
OVPN_DIR="$(dirname "$OVPN_CONFIG")"
VPN_PASS="YOUR_VPN_PASSWORD_HERE"
# --- Require sudo upfront and keep it alive ---
#!/usr/bin/env bash
# flat_pdf.sh - Bake PDF annotations into page content (flatten)
# Usage: flat_pdf.sh input.pdf
# Output: input-flat.pdf
set -e
if [[ $# -ne 1 ]]; then
echo "Usage: $0 input.pdf"
exit 1
@bagustris
bagustris / disk-guardian
Last active May 1, 2026 11:10
Kill the process to prevent 100% disk usage
#!/bin/bash
# Kill the top disk-writing process when a filesystem exceeds a usage threshold.
# Usage: disk-guardian [threshold%] [mountpoint]
# /tmp/disk-guardian
THRESHOLD="${1:-95}"
MOUNTPOINT="${2:-/}"
LOG="/var/log/disk-guardian.log"
@bagustris
bagustris / keybindings.json
Created May 7, 2026 01:54
Keyboard shortcut for my VSCode
// Place your key bindings in this file to override the defaults
[
// {
// "key": "cmd+shift+h",
// "command": "workbench.action.terminal.newWithCwd",
// "args": {
// "cwd": "${fileDirname}"
// }},
{
"key": "alt+t",