Skip to content

Instantly share code, notes, and snippets.

View evantkchong's full-sized avatar
🐢

Evan Chong evantkchong

🐢
View GitHub Profile
@aidos-dev
aidos-dev / README.md
Last active February 25, 2026 22:48
How to connect Apple AirPods to Linux (Debian/Ubuntu/Mint)

How to connect Apple AirPods to Linux (Debian/Ubuntu/Mint)

Step 1.

Open your terminal.

In the root directory run the command:

sudo nano /etc/bluetooth/main.conf
@overengineer
overengineer / OneDarkProMonokaiDarker.sh
Last active July 17, 2025 06:21
One Dark Pro Monokai Darker Gnome Terminal Theme
#!/bin/sh
# usage: cat "source OneDarkProMonokaiDarker.sh" >> ~/.bashrc
if [ "${TERM%%-*}" = 'linux' ]; then
# This script doesn't support linux console (use 'vconsole' template instead)
return 2>/dev/null || exit 0
fi
color00="5c/63/70"
color01="f4/47/47"
@0xRampey
0xRampey / dark-mode.scss
Last active August 24, 2022 02:28
Dark mode on fastpages blogs
$high-emph: rgba(white, 0.87);
$med-emph: rgba(white, 0.69); //Noicee
$low-emph: rgba(white, 0.38);
$dark-grey : #121212;
// $dark-grey : #1F1B24;
$overlay: mix($dark-grey, white, 95%);
$overlay-light: mix($dark-grey, white, 86%);
html, body, input, textarea, select, button {
color: $high-emph !important;
@ElegantSoft
ElegantSoft / validate_enum.go
Created September 23, 2020 01:17
Use enum validation in golang with gin with custom error messages
// user model
type User struct {
gorm.Model
Name string `json:"name" binding:"required" gorm:"not null:true"`
Phone string `json:"phone" binding:"required"`
Email string `json:"email" binding:"required,email" gorm:"not null:true"`
Password string `json:"password" binding:"required,min=8" gorm:"not null:true"`
Gender string `json:"gender" binding:"Enum=male_female" gorm:"type:gender;not null:true;default:male"` // add binding Enum=male_female
}
@nicknapoli82
nicknapoli82 / cs50_Tideman_cycle-explanation.md
Last active December 25, 2025 18:02
My attempt at clarifying how cycles work for the Tideman algorithm

A Way to Look at Tideman Lock Pairs

I've observed that there is a little bit of a disconnect in understanding what it is that needs to be done to properly implement the lock_pairs function for cs50 Tideman. The goal of this little write-up is simply an attempt at explaining what the problem actually is, and why a cycle imposes a problem.

First:
If you are unfamiliar with the actual problem, or have not read through the entire cs50 Tideman problem description. Then I think you should start there.
cs50 Tideman

Second:
This little write-up is only narrowing in on the idea of cycles, and a way to think about what a cycle is and determine if locking a pair in the pairs array would create that cycle. This does not talk about any other part of the Tideman problem.

@bartzalewski
bartzalewski / JetBrains-Mono.css
Last active December 9, 2020 10:49
Minified CSS for using JetBrains Mono on my portfolio.
@font-face {
font-family: "JetBrains Mono Regular";
src: url("https://raw.githubusercontent.com/JetBrains/JetBrainsMono/master/web/eot/JetBrainsMono-Regular.eot")
format("embedded-opentype"),
url("https://raw.githubusercontent.com/JetBrains/JetBrainsMono/master/web/woff2/JetBrainsMono-Regular.woff2")
format("woff2"),
url("https://raw.githubusercontent.com/JetBrains/JetBrainsMono/master/web/woff/JetBrainsMono-Regular.woff")
format("woff"),
url("https://raw.githubusercontent.com/JetBrains/JetBrainsMono/master/ttf/JetBrainsMono-Regular.ttf")
format("truetype");
@showa-yojyo
showa-yojyo / producer_consumer.py
Created May 12, 2020 10:02
Implement Producer/Consumer pattern with asyncio.Queue
#!/usr/bin/env python
"""
A simple producer/consumer example, using Queue.task_done and Queue.join
From https://asyncio.readthedocs.io/en/latest/producer_consumer.html
"""
import asyncio
import random
@aplz
aplz / draw_text_with_background_opencv.py
Last active February 3, 2025 23:46
draw text with background // opencv
import cv2 # opencv
import numpy as np
font_scale = 1.5
font = cv2.FONT_HERSHEY_PLAIN
# set the rectangle background to white
rectangle_bgr = (255, 255, 255)
# make a black image
img = np.zeros((500, 500))
@jeremyjordan
jeremyjordan / sgdr.py
Last active December 4, 2023 13:41
Keras Callback for implementing Stochastic Gradient Descent with Restarts
from keras.callbacks import Callback
import keras.backend as K
import numpy as np
class SGDRScheduler(Callback):
'''Cosine annealing learning rate scheduler with periodic restarts.
# Usage
```python
schedule = SGDRScheduler(min_lr=1e-5,
@nrollr
nrollr / Python.md
Last active October 18, 2025 20:44
Python environments in macOS

Python environments in macOS

The latest version of macOS 10.13.3 has Python 2.7.10 installed by default, yet Python has been available on macOS and previously OS X for quite a while now.

Consult the Apple's Open Source Reference Library, and browse through the various releases of the OS to find out which Python version was included). But what if you have a project which requires Python 3 ?

The following instructions will guide you through the process of:

  • installing Python 3 using Homebrew
  • running multiple Python verions as sandboxed environments