Skip to content

Instantly share code, notes, and snippets.

View altbdoor's full-sized avatar
🐵

Ng Han Seng altbdoor

🐵
  • Kuala Lumpur, Malaysia
  • 16:14 (UTC +08:00)
View GitHub Profile
@altbdoor
altbdoor / docker-compose.yml
Last active April 19, 2024 07:14
Docker compose for Wordpress and MariaDB
version: "3.9"
# borrowed from
# https://github.com/docker/awesome-compose/blob/master/wordpress-mysql/compose.yaml
services:
db:
# https://make.wordpress.org/hosting/handbook/compatibility/#wordpress-php-mysql-mariadb-versions
image: mariadb:11.3
command: '--default-authentication-plugin=mysql_native_password'
volumes:
@altbdoor
altbdoor / pack-gog-games.py
Last active March 24, 2024 16:24
Pack the GOG games entries into a SQLite database
#!/usr/bin/env python
"""
Pack the GOG games entries into a SQLite database
License: WTFPL
https://github.com/ezerear/gog-games.to_backup
"""
import json
@altbdoor
altbdoor / CzechiaFlag.java
Created March 8, 2024 08:55
Drawing Czechia flag with Java AWT
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
class CzechiaFlag {
static class CzechiaFlagComponent extends Component {
public void paint(Graphics g) {
@altbdoor
altbdoor / wsl2-alpine.md
Last active February 12, 2024 07:35
Running Alpine with WSL2 and Docker

Running Alpine with WSL2 and Docker

Prepare Windows

  1. Turn Windows features on or off
  2. Enable:
    1. Windows Subsystem for Linux (WSL)
    2. Virtual Machine Platform
  3. wsl --update
@altbdoor
altbdoor / fix-sass-include-paths.cjs
Created May 10, 2023 03:35
NodeJS script to fix include paths in Angular JSON
#!/usr/bin/env node
/* eslint-env node */
const process = require("process");
const fs = require("fs");
const args = process.argv.slice(2);
if (args.length !== 1) {
console.error("Please pass in path to angular.json file");
process.exit(1);
@altbdoor
altbdoor / duck-emote.py
Created March 21, 2023 11:06
Gather duck emotes
#!/usr/bin/env python3
import urllib.request
import urllib.parse
from bs4 import BeautifulSoup
base_url = 'https://www.sigstick.com/stickers'
params = { 'author': 'kal (we-巫巴多-duck)' }
url = f'{base_url}?{urllib.parse.urlencode(params)}'
@altbdoor
altbdoor / LICENSE
Last active October 4, 2022 12:47
Manually generating an Angular SCAM
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@altbdoor
altbdoor / fix.sh
Created October 24, 2021 14:57
Manually getting the date in filename with awk
#!/bin/bash
CURRENT_DIR="$( cd "$(dirname "${BASH_SOURCE[0]}")" && pwd )"
cd "$CURRENT_DIR"
workpath="$1"
cd "${workpath}"
for image in *.jpeg; do
date_format=$(echo "${image}" | awk '{gsub(/-/, ":", $3); print $3}')
@altbdoor
altbdoor / example.reducer.ts
Last active January 10, 2020 07:22
Proposed basis of NgRx reducer files
import { Action, createReducer, on } from '@ngrx/store';
export const featureKey = 'niceFeature';
export interface State {}
export const initialState: State = {};
const reducerFn = createReducer(
initialState,
@altbdoor
altbdoor / install_node.sh
Last active May 10, 2022 07:02
Install nodejs to home directory
#!/bin/bash
# install via
# bash <(curl -L 'https://gist.githubusercontent.com/altbdoor/9c801dcad5f11352e3dc346ba9ebaf9c/raw/install_node.sh')
default_version="14"
node_regexp='node-v.+?-linux-x64.tar.xz'
read -p "Enter desired major version, or leave blank for latest-v${default_version}.x: " node_version