Skip to content

Instantly share code, notes, and snippets.

View CheyiLin's full-sized avatar

Cheyi Lin CheyiLin

View GitHub Profile
@CheyiLin
CheyiLin / Logger.cs
Last active September 29, 2020 07:37
//#define LOG_DEBUG
//#define LOG_THREAD_STATE
using UnityEngine;
using System;
using System.Text;
using System.Threading;
using System.Collections;
using System.Reflection;
using System.Diagnostics;
@echo off
set OUTPUT_LIB=MyPackage.dll
set INPUT_FILES=^
..\src\MySource1.cs ^
..\src\MySource2.cs
set DEFINES=LOG_DEBUG,MY_DEBUG
--[[
The MIT License (MIT)
Copyright (c) Cheyi Lin <[email protected]>
]]
local bit_xor
if jit and jit.version_num > 20000 then
bit_xor = bit.bxor
else
bit_xor = bit32.bxor
local print = print -- upvalue index 1
local a = 100 -- upvalue index 2
function func()
print("in func: ", a, b)
end
-- set global 'a', 'b' to function 'func'
setfenv(func, { a = 200, b = 101 })
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "18"
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"extensions/v1beta1","kind":"Deployment","metadata":{"annotations":{"kubernetes.io/change-cause":"kubectl apply --filename=deploy\\system\\ingress\\nginx-ingress-controller.yaml --record=true"},"name":"nginx-ingress-controller","namespace":"nginx-ingress"},"spec":{"replicas":4,"revisionHistoryLimit":2,"selector":{"matchLabels":{"k8s-app":"nginx-ingress-lb"}},"strategy":{"rollingUpdate":{"maxSurge":1,"maxUnavailable":0},"type":"RollingUpdate"},"template":{"metadata":{"annotations":{"prometheus.io/port":"10254","prometheus.io/scrape":"true"},"labels":{"k8s-app":"nginx-ingress-lb"}},"spec":{"containers":[{"args":["/nginx-ingress-controller","--default-backend-service=$(POD_NAMESPACE)/default-http-backend","--configmap=$(POD_NAMESPACE)/nginx-config","--tcp-services-configmap=$(POD_NAMESPACE)/nginx-tcp-ingress-configmap","--
@CheyiLin
CheyiLin / birthday_rank.list
Created January 9, 2018 06:15
Birthday Rank 2018
No 001: 09/07
No 002: 05/20
No 003: 09/06
No 004: 03/15
No 005: 10/28
No 006: 12/24
No 007: 11/11
No 008: 11/03
No 009: 09/18
No 010: 07/26
@CheyiLin
CheyiLin / macos-vpn-keepalive.scpt
Last active May 7, 2021 09:17
A simple AppleScript to prevent VPN session from timing out
on idle
set checkIval to 60
set vpnName to "YOUR_VPN_NAME"
set pingDest to "PING_DEST_THRU_VPN"
tell application "System Events"
tell current location of network preferences
set vpnConn to service vpnName
if vpnConn is not null then
if current configuration of vpnConn is connected then
@CheyiLin
CheyiLin / macos-tweaks.sh
Created May 3, 2022 11:40
macOS Tweaks
# https://www.techjunkie.com/hidpi-mode-os-x/
sudo defaults write /Library/Preferences/com.apple.windowserver.plist DisplayResolutionEnabled -bool true
defaults write com.apple.dock autohide-delay -int 0
defaults write com.apple.dock autohide-time-modifier -float 0.4
killall Dock
defaults write bluetoothaudiod "Enable AptX codec" -bool true
defaults write bluetoothaudiod "Enable AAC codec" -bool true
@CheyiLin
CheyiLin / rate_limit_worker.go
Created October 13, 2023 03:21
Producer and consumer workers with rate limit
package main
import (
"context"
"fmt"
"sync"
"time"
"golang.org/x/time/rate"
)