Skip to content

Instantly share code, notes, and snippets.

View alazycoder101's full-sized avatar

Lazy coder alazycoder101

View GitHub Profile
"foo" + "bar"
RubyVM::InstructionSequence.compile('"foo" + "bar"').to_a
1 + 2 * 3
# => 7
puts RubyVM::InstructionSequence.compile("1 + 2 * 3").disasm
 # Exponential Backoff
 # Allows 20 requests in 8  seconds
 #        40 requests in 64 seconds
 #        ...
 #        100 requests in 0.38 days (~250 requests/day)

 (1..5).each do |level|
   Rack::Attack.throttle("signin/ip/#{level}", :limit => (20 * level), :period   => (8 ** level).seconds) do |req|
 if req.path == '/signin' && req.post?
@alazycoder101
alazycoder101 / diff.rb
Last active June 22, 2022 17:47
memory puma
#!/usr/bin/env ruby
require 'set'
require 'json'
if ARGV.length != 3
puts "Usage: detect_leaks [FIRST.json] [SECOND.json] [THIRD.json]"
exit 1
end
// ==UserScript==
// @name userCenter
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://hk.sz.gov.cn:8118/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=sz.gov.cn
// @grant none
// ==/UserScript==
@alazycoder101
alazycoder101 / useful-postgresql-sql.md
Last active May 20, 2022 12:02
Useful PostgreSQL queries

table

SELECT table_name, column_name, ordinal_position FROM information_schema.columns
WHERE table_schema = 'public'
   AND table_name   = 'my_table'
     ;

14天以上入境计划 香港入境许可申请: 為縮短處理時間,申請表格及證明文件可第一時間傳真至(852) 2824 1133。簽署妥當的申請表格正本及所需照片應隨即以空郵寄交入境事務處。入境事務處在收到申請表格正本,並審核妥當後才會發出獲批准的簽證/進入許可

https://www.immd.gov.hk/hkt/forms/forms/id1003a.html 來港旅遊/過境申請表(由申請人填寫)

7天入境计划: 香港入境7天: 从第二天开始算起+7 香港隔离7天: 从第一天开始算起+7

香港检测要求: https://www.hongkongairport.com/sc/COVID19.page

# check client version
velero version --client-only

# install cRD changes
velero install --crds-only --dry-run -o yaml | kubectl apply -f -

# update image
kubectl set image deployment/velero velero=velero/velero:v1.8.1 --namespace velero

You can try to use Cypress to monitor your production env and report to prometheos. Show it in Grafana.

You can try to use it in GKE,AKE or heroku.

But for now you can only container in heroku.

test

image

section: screens
macbook:
halfDuplexCapsLock = false
halfDuplexNumLock = false
halfDuplexScrollLock = false
xtestIsXineramaUnaware = false
preserveFocus = false
switchCorners = none
switchCornerSize = 0
windows: