Skip to content

Instantly share code, notes, and snippets.

View altbdoor's full-sized avatar
🐵

Ng Han Seng altbdoor

🐵
  • Kuala Lumpur, Malaysia
  • 19:16 (UTC +08:00)
View GitHub Profile
@altbdoor
altbdoor / app.py
Created February 21, 2025 02:16
Streamlit as UI for Selenium scripts
import atexit
import streamlit as st
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import WebDriverException
def init_chrome():
chrome_options = webdriver.ChromeOptions()
# chrome_options.add_argument("--headless=new")
@altbdoor
altbdoor / time-fix.sh
Created November 14, 2024 09:26
AI/GPT generated Bash script to rename and set dates with exiftool
#!/bin/bash
# Folder where your images are located
folder="./"
# Loop through each image in the folder
for filename in "$folder"/*; do
# Extract the date and time from the filename using regex
if [[ $filename =~ ([a-z]{3,})-([0-9]{1,2})[a-z]{2}-([0-9]{4})-at-([0-9]{1,2})([0-9]{2})-([ap]m)\.[a-z]{3,4} ]]; then
month="${BASH_REMATCH[1]}"
@altbdoor
altbdoor / note.md
Last active June 8, 2024 05:02
LTI 1.3 notes
@altbdoor
altbdoor / force-gpt3.user.js
Last active June 10, 2024 02:18
Force ChatGPT to use GPT3
// ==UserScript==
// @name Force GPT3
// @namespace altbdoor
// @match https://chatgpt.com/*
// @grant none
// @version 1.1
// @author altbdoor
// @run-at document-start
// @updateURL https://gist.github.com/altbdoor/ff538bc6b411583fdc500750e7faff04/raw/force-gpt3.user.js
// @downloadURL https://gist.github.com/altbdoor/ff538bc6b411583fdc500750e7faff04/raw/force-gpt3.user.js
@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 July 6, 2024 09:08
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)}'