Skip to content

Instantly share code, notes, and snippets.

View truongvan's full-sized avatar

Truong Van truongvan

View GitHub Profile
@truongvan
truongvan / libremap_mapbox_transfer.ts
Last active February 8, 2025 03:04
A TypeScript utility to convert Mapbox GL styles into LibreMap-compatible styles by transforming layers, expressions, and data sources.
const MAPBOX_ACCESS_TOKEN = "12346789"
interface UrlObject {
protocol: string;
authority: string;
path: string;
params: string[];
}
export function isMapboxURL(url: string) {
# Title: Duck's Light
# Description: Size-optimised version.
# Expires: 1 month
# Last modified: 24 Aug 2025 00:00 UTC
# Version: 2025.8.1
# Syntax: Domains (including possible subdomains)
# Number of entries: 308
#
mobile.events.data.microsoft.com
browser-intake-datadoghq.com
setInterval(function() {
document.querySelector(".notion-sidebar-trash-menu> div:nth-child(2) > div > div > div > div > div:nth-child(3) > div > div:nth-child(2)").click();
setTimeout(function() {
let deleteButton = document.querySelector("[role='dialog'] [role='menu'] > div > [role='button']");
if (deleteButton && deleteButton.textContent.includes("Delete")) {
deleteButton.click()
};
}, 500)
}, 2000
)
@truongvan
truongvan / dracula_ide.toml
Created April 6, 2023 02:02
Helix theme Dracula
"comment" = { fg = "comment" }
"constant" = { fg = "purple" }
"constant.character.escape" = { fg = "pink" }
"function" = { fg = "green" }
"keyword" = { fg = "pink" }
"operator" = { fg = "pink" }
"punctuation" = { fg = "foreground" }
"string" = { fg = "yellow" }
"string.regexp" = { fg = "red" }
"tag" = { fg = "pink" }
def get_pois_from_amadues_task():
"""Get POIs from Amadeus."""
if cache.get("get_pois_from_amadues_task"):
return
else:
# Time out in 24 hours
cache.set("get_pois_from_amadues_task", True, timeout=3600 * 24)
# Get geocoding object with user location and no point of interest
# or user location and number of downloaded iterm is smaller than total number of item
@truongvan
truongvan / checkwifi.sh
Last active October 7, 2022 03:14
restart wifi raspberry pi
ping -c4 192.168.1.1 > /dev/null
if [ $? != 0 ]
then
sudo ifconfig wlan0 down
sleep 5
sudo ifconfig wlan0 up
fi
from datetime import datetime
class Person:
def __init__(self, n, dob):
self.name = n
self.date_of_birth = dob
def age(self):
return (datetime.now() - self.date_of_birth).days / 365
class HinhChuNhat:
def __init__(self, d, r):
"""
các object được tạo từ class `HinhChuNhat` sẽ có 2 thuộc tính
là `dai` và `rong`.
"""
self.dai = d
self.rong = r
def dientich(self):
# Thêm hàm sqrt, căng bật hai của một số từ thư viện `math`.
from math import sqrt
# `HinhVuong(object)` có nghĩa là class hình vuông thừa hưởng các thuộc tính từ class
class HinhVuong:
def __init__(self, a):
self.canh = a
def can_hold (self, other):
"""
Kiểm tra xem hình vuông đang xét (self) thể chứa hình vuông hoặc tròn khác (other) hay không?