Skip to content

Instantly share code, notes, and snippets.

View lkebin's full-sized avatar
🎯
Focusing

Kebin Liu lkebin

🎯
Focusing
  • Beijing
View GitHub Profile
@lkebin
lkebin / my_uuid.go
Created May 22, 2021 03:14
MySQL UUID_TO_BIN and BIN_TO_UUID implementation in Go
package main
import (
"fmt"
"github.com/google/uuid"
)
func main() {
var id = "299feb0f-ba8d-11eb-9453-0242ac130003"
@lkebin
lkebin / run_after_update.sh
Created August 23, 2019 13:32
Run command after Docker image update, but nothing to do if no update
#!/bin/sh
script=$(basename $0)
image=$1
arg=$@
function current() {
local a=$(docker inspect ${image} -f '{{index .RepoDigests 0}}')
echo ${a#*@}
}
@lkebin
lkebin / ascii.txt
Created May 21, 2019 13:25
ascii table
Dec Hex Dec Hex Dec Hex Dec Hex Dec Hex Dec Hex Dec Hex Dec Hex
0 00 NUL 16 10 DLE 32 20 48 30 0 64 40 @ 80 50 P 96 60 ` 112 70 p
1 01 SOH 17 11 DC1 33 21 ! 49 31 1 65 41 A 81 51 Q 97 61 a 113 71 q
2 02 STX 18 12 DC2 34 22 " 50 32 2 66 42 B 82 52 R 98 62 b 114 72 r
3 03 ETX 19 13 DC3 35 23 # 51 33 3 67 43 C 83 53 S 99 63 c 115 73 s
4 04 EOT 20 14 DC4 36 24 $ 52 34 4 68 44 D 84 54 T 100 64 d 116 74 t
5 05 ENQ 21 15 NAK 37 25 % 53 35 5 69 45 E 85 55 U 101 65 e 117 75 u
6 06 ACK 22 16 SYN 38 26 & 54 36 6 70 46 F 86 56 V 102 66 f 118 76 v
7 07 BEL 23 17 ETB 39 27 ' 55 37 7 71 47 G 87 57 W 103 67 g 119 77 w
8 08 BS 24 18 CAN 40 28 ( 56 38 8 72 48 H 88 58 X 104 68 h 120 78 x
package main
import (
"fmt"
"regexp"
)
func main() {
var a = "https://lkebin.com/2019/05/13/Golang-Json-Unmarshaler-Interface-Use-Case.html"
@lkebin
lkebin / custom_unmarshal_json.go
Last active May 13, 2019 07:31
Golang Customized UnmarshalJSON Use Case https://play.golang.org/p/HwYr3Pm6hg_P
package main
import (
"encoding/json"
"fmt"
)
type Picture string
type Profile struct {
@lkebin
lkebin / tableGoStruct.sql
Last active May 10, 2019 08:36
MySQL table schema to Golang struct
DELIMITER $$
CREATE PROCEDURE `tableGoStruct`(
IN dbName VARCHAR(50) ,
IN tableName VARCHAR(50)
)
BEGIN
DECLARE struct LONGTEXT;
DECLARE structType VARCHAR(10);
DECLARE colName VARCHAR(64);
package main
import (
"fmt"
"sync"
)
func main() {
var workers = 4
var wg sync.WaitGroup
@lkebin
lkebin / week3_1.asm
Last active August 16, 2018 09:29
Computer Organization
.data
uStr: .asciiz
"Alpha","Bravo","China","Delta","Echo","Foxtrot","Golf","Hotel",
"India","Juliet","Kilo","Lima","Mary","November","Oscar","Paper","Quebec",
"Research","Sierra","Tango","Uniform","Victor","Whisky","X-ray","Yankee","Zulu"
lStr: .asciiz
"alpha","bravo","china","delta","echo","foxtrot","golf","hotel","india",
"juliet","kilo","lima","mary","november","oscar","paper","quebec","research",
This file has been truncated, but you can view the full file.
Options << Options#applyProfile [
"auto switch"
]
Options << Options#updateProfile [
[
"auto switch",
"__ruleListOf_auto switch",
"proxy",
"direct"
]
@lkebin
lkebin / chrome_downloader.sh
Last active June 23, 2017 04:07
Script for download standalone Chrome browser
#!/bin/sh
GOOGLE_DL="https://dl.google.com"
WIN_32="/update2/installers/ChromeStandaloneSetup.exe"
WIN_64="/update2/installers/ChromeStandaloneSetup64.exe"
MAC="/chrome/mac/stable/GGRO/googlechrome.dmg"
DL_WIN_DIR=./chrome/windows
DL_MAC_DIR=./chrome/macos