Skip to content

Instantly share code, notes, and snippets.

View wey-gu's full-sized avatar
Believe in OpenSource and build in public w/ magic to help others do the same.

Wey Gu wey-gu

Believe in OpenSource and build in public w/ magic to help others do the same.
View GitHub Profile
laixintao /
Last active February 20, 2024 12:05
Send HTTP requests using python-requests with timeout, tcp reuse(session) and retry.
from requests.adapters import HTTPAdapter, Retry
from requests import Session
retries = Retry(
total=5, backoff_factor=1, status_forcelist=[502, 503, 504]
session = Session() # reuse tcp connection
session.mount("http://", HTTPAdapter(max_retries=retries))
session.mount("https://", HTTPAdapter(max_retries=retries))
toricls /
Last active April 25, 2024 15:30
Using Lima to run containers with containerd and nerdctl (without Docker Desktop) on M1 Macs

Lima (Linux virtual machines, on macOS) installation guide for M1 Mac.

Sep. 27th 2021 UPDATED

Now we can install patched version of QEMU via Homebrew (thank you everyone for the info!). Here is the updated instruction with it:

Used M1 Mac mini 2020 with macOS Big Sur Version 11.6.

1. Install QEMU & Lima

nrjdalal /
Last active February 1, 2024 05:31
Create Virtual Machines using QEMU on Silicon based Apple Macs

Install QEMU on Silicon based Apple Macs (June 2021)

Option 1 - Automatically

zsh -c "$(curl -fsSL"

Option 2 - Manually

  • Install Xcode command line tools

xcode-select --install
schaumb /
Last active December 29, 2023 02:16
streamlit redirect
import streamlit as st
import io
import contextlib
import sys
import re
import threading
class _Redirect:
class IOStuff(io.StringIO):
zzzeek /
Last active July 5, 2023 16:32
An asyncio program that runs rows into a Postgresql database, using blocking style code to actually run the database commands
"""This program is exactly the same as that of ,
with the exception that the add_and_select_data function is written in
synchronous style.
UPDATED!! now includes refinements by @snaury and @Caselit . SIMPLER
sualeh /
Last active April 5, 2024 05:55
How to Sign and Release to The Central Repository with GitHub Actions

How to Sign and Release to The Central Repository with GitHub Actions

GitHub allows automated builds using GitHub Actions. A commonly asked question is how to release artifacts (packaged Java jars) built by Maven and Gradle to The Central Repository. The GitHub Actions documentation provides only part of the answer.

So, first, configure your Maven project for staging artifacts to The Central Repository, by reading through Configuring Your Project for Deployment and following those steps. Please make sure that the maven-gpg-plugin is configured to prevent gpg from using PIN entry programs, as follows:

printf "%dGi/32Gi" $(cat /proc/meminfo | awk '{print $2}' | head -n 2 | tail -n 1)/1024/1024
Retries a powershell command n-times.
The cmdlet is capable of retrying a PowerShell command passed as a [ScriptBlock] according to the user defined number of retries and timeout (In Seconds)
.PARAMETER TimeoutInSecs
Timeout in secods for each retry.
nickgrealy / slack_emoticons_to_html_unicode.json
Created August 17, 2018 06:20
"+1": "&#x1F44D;",
"-1": "&#x1F44E;",
"100": "&#x1F4AF;",
"1234": "&#x1F522;",
"8ball": "&#x1F3B1;",
"ab": "&#x1F18E;",
"abc": "&#x1F524;",
"abcd": "&#x1F521;",
"accept": "&#x1F251;",