Skip to content

Instantly share code, notes, and snippets.

View lemon-li's full-sized avatar

Le Li lemon-li

  • KingSoft
  • Beijing
  • 15:48 (UTC +08:00)
View GitHub Profile
@lemon-li
lemon-li / graceful.go
Last active April 18, 2022 02:07 — forked from aladhims/graceful_shutdown.go
Graceful Shutdown Go App
package graceful
import (
"context"
"log"
"os"
"os/signal"
"sync"
"syscall"
"time"
@CHSuworatrai
CHSuworatrai / VMware vSphere 6.x Licence Keys
Created April 8, 2021 09:20 — forked from DVSB/VMware vSphere 6.x Licence Keys
VMware vSphere 6 and 7 Licence Keys
VMware vSphere 6 Enterprise Plus
1C20K-4Z214-H84U1-T92EP-92838
1A2JU-DEH12-48460-CT956-AC84D
MC28R-4L006-484D1-VV8NK-C7R58
5C6TK-4C39J-48E00-PH0XH-828Q4
4A4X0-69HE3-M8548-6L1QK-1Y240
VMware vSphere with Operations Management 6 Enterprise
4Y2NU-4Z301-085C8-M18EP-2K8M8
1Y48R-0EJEK-084R0-GK9XM-23R52
@aladhims
aladhims / graceful_shutdown.go
Last active April 20, 2025 08:59
Graceful Shutdown Go App
package main
// operation is a clean up function on shutting down
type operation func(ctx context.Context) error
// gracefulShutdown waits for termination syscalls and doing clean up operations after received it
func gracefulShutdown(ctx context.Context, timeout time.Duration, ops map[string]operation) <-chan struct{} {
wait := make(chan struct{})
go func() {
s := make(chan os.Signal, 1)
@lemon-li
lemon-li / gist:bb5b5d9b7ce203345b6c943791198408
Created December 2, 2020 12:02 — forked from sebsto/gist:6af5bf3acaf25c00dd938c3bbe722cc1
Start VNCServer on Mac1 EC2 Instance
# YouTube (english) : https://www.youtube.com/watch?v=FtU2_bBfSgM
# YouTube (french) : https://www.youtube.com/watch?v=VjnaVBnERDU
#
# On your laptop, connect to the Mac instance with SSH (similar to Linux instances)
#
ssh -i <your private key.pem> ec2-user@<your public ip address>
#
# On the Mac
@sebsto
sebsto / gist:6af5bf3acaf25c00dd938c3bbe722cc1
Last active November 3, 2024 19:16
Start VNCServer on Mac1 EC2 Instance
# YouTube (english) : https://www.youtube.com/watch?v=FtU2_bBfSgM
# YouTube (french) : https://www.youtube.com/watch?v=VjnaVBnERDU
#
# On your laptop, connect to the Mac instance with SSH (similar to Linux instances)
#
ssh -i <your private key.pem> ec2-user@<your public ip address>
#
# On the Mac
@zhiguangwang
zhiguangwang / README.md
Last active May 10, 2021 04:00
Extending Linux file system after resizing EBS volume

Extend partition on root volume

sudo growpart /dev/nvme0n1 1

Extend file system on root volume

ext4

@zhiguangwang
zhiguangwang / README.md
Last active April 7, 2025 20:59
Use Nomad "spread" Scheduler

Read Scheduler Config

curl -sS --header "X-Nomad-Token: $NOMAD_TOKEN" "$NOMAD_ADDR/v1/operator/scheduler/configuration" | jq .

Sample Output

{
@adammagana
adammagana / Logging.swift
Last active September 5, 2023 20:29
A convenient Swift protocol and wrapper for OSLog.
import os
private let subsystem = "<ENTER-YOUR-SUBSYSTEM-STRING-HERE>"
// MARK: - Protocol
protocol LogProducer {
func debug(_ message: StaticString, _ messageArguments: CVarArg...)
func info(_ message: StaticString, _ messageArguments: CVarArg...)
func warn(_ message: StaticString, _ messageArguments: CVarArg...)
@zhiguangwang
zhiguangwang / docker-sslocal.sh
Created August 4, 2019 07:39
Configure the Docker daemon to use ss-local as HTTP/HTTPS proxy.
#!/bin/bash
set -e
function print_usage {
echo
echo "Usage: docker-sslocal.sh [OPTIONS]"
echo
echo "This script is to configure the Docker daemon to use ss-local as HTTP/HTTPS proxy."
echo
@zsoumya
zsoumya / bc4trialreset.cmd
Created July 12, 2019 21:25
Beyond Compare 4 Trial Reset
reg delete "HKCU\Software\Scooter Software\Beyond Compare 4" /v CacheID /f