Skip to content

Instantly share code, notes, and snippets.

View abserari's full-sized avatar
🐱
Let's build a better world

DingRui Yang abserari

🐱
Let's build a better world
View GitHub Profile
@abserari
abserari / Profile Metrics
Last active July 5, 2023 16:05
Profile Metrics
Placeholder
#!/bin/env bash
# Dependencies: tesseract-ocr flameshot imagemagick xclip
#Name: OCR Picture
#Fuction: take a screenshot and OCR the letters in the picture
#Path: /home/Username/...
#you can only scan one character at a time
SCR="/home/Username/pictures/SCR"
@abserari
abserari / install.go
Created November 21, 2022 09:09
Go Install Binary Program in Dapr
// installBinary installs the daprd, placement or dashboard binaries and associated files inside the default dapr bin directory.
func installBinary(version, binaryFilePrefix, githubRepo string, info initInfo) error {
var (
err error
filepath string
)
dir := defaultDaprBinPath()
if isAirGapInit {
filepath = path_filepath.Join(info.fromDir, *info.bundleDet.BinarySubDir, binaryName(binaryFilePrefix))
@abserari
abserari / Makefile
Last active June 23, 2022 01:17
Makefile Template from Temporal
default: help
##@ Main targets
install: update-tools ## Install all tools and builds binaries.
bins: ## Rebuild binaries (used by Dockerfile).
all: update-tools clean proto bins check test ## Install all tools, recompile proto files, run all possible checks and tests (long but comprehensive).
ci-build: update-tools shell-check check proto mocks gomodtidy ensure-no-changes ## Used by Buildkite.
@abserari
abserari / map-equal.go
Created March 9, 2022 03:21
golang map equal
func equal(x, y map[string]int) bool {
if len(x) != len(y) {
return false
}
for k, xv := range x {
if yv, ok := y[k]; !ok || yv != xv {
return false
}
}
return true
@abserari
abserari / drag_and_drop.dart
Created May 10, 2021 15:30
Drag to Generate Flutter UI
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
@abserari
abserari / README.md
Created March 16, 2021 15:04
how the texas poker win or not
@abserari
abserari / visitor.go
Created March 12, 2021 00:33
visitor model
package visitor
import (
"context"
"errors"
"github.com/silverswords/pulse/pkg/message/retry"
"github.com/silverswords/pulse/pkg/message/timingwheel"
"log"
"time"
)
@abserari
abserari / ssh.go
Last active January 18, 2021 10:18
quickly ssh transport
package sshproxy
import (
"bytes"
"encoding/binary"
"fmt"
"golang.org/x/crypto/ssh"
"io"
"io/ioutil"
"log"
@abserari
abserari / maxopenfile.go
Created January 18, 2021 09:55
Update system limit about file number.
package maxopenfile
import (
"log"
"syscall"
)
func MaxOpenFiles() {
var rLimit syscall.Rlimit