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
@saelo
saelo / decorator.go
Created March 8, 2015 19:45
Decorators in Go
package main
import (
"fmt"
"reflect"
)
func Decorate(impl interface{}) interface{} {
fn := reflect.ValueOf(impl)
@FZambia
FZambia / redispubsub.go
Last active January 20, 2021 11:21
Redis PUB/SUB vs RethinkDB PUB/SUB
package main
import (
"github.com/garyburd/redigo/redis"
)
func main() {
subConn, err := redis.Dial("tcp", "127.0.0.1:6379")
if err != nil {
panic(err)
@ipcjs
ipcjs / +Rime+小鹤双拼+颜文字+笔画混合输入方案.md
Last active August 19, 2025 15:54
Rime+小鹤双拼+颜文字+笔画混合输入方案

Rime+小鹤双拼+颜文字+笔画混合输入方案

概述

方案配置文件+详细说明:Rime+小鹤双拼+颜文字+笔画混合输入方案

实现的功能是:给小鹤双拼添加颜文字支持,直接打双拼出颜文字,支持模糊音,支持词频调整,同时不影响小鹤双拼自带的笔画反查。

要实现双拼+颜文字的功能网上已经有很多方法,但都有些弊端,这里分别简单介绍下:

@krishnasrinivas
krishnasrinivas / bucket-policies-primer.md
Created September 9, 2017 19:51 — forked from harshavardhana/bucket-policies-primer.md
Explanation of bucket polices by example

Bucket Policy

Bucket policy is an access policy available for you to grant anonymous permissions to your Minio resources. Bucket policy uses JSON-based access policy language.

This section presents a few examples of typical use cases for bucket policies. The policies use testbucket strings in the resource value. To test these policies, you need to replace these strings with your bucket name. For more information please read Amazon S3 access policy language

Granting Read-Only Permission to an Anonymous User

The following example policy grants the s3:GetObject permission to any public anonymous users. This permission allows anyone to read the object data under testbucket, which is useful for when you have publicly readable assets. A typical example is a website assets stored in testbucket.

@michaelboke
michaelboke / Dockerfile
Last active August 12, 2025 08:32
Docker scratch x509 fix
FROM golang:alpine as builder
WORKDIR /app
#the following 2 steps are optional if your image does not already have the certificate
# package installed, golang:alpine now seems to have it. But a more base image could be missing it.
#RUN apk update && apk upgrade && apk add --no-cache ca-certificates
#RUN update-ca-certificates
ADD main.go /app/main.go
RUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags="-s -w" -installsuffix cgo -o app .
FROM scratch
@superseb
superseb / kubectl.yml
Created May 18, 2018 20:07
Rancher 2.0 nfs-provisioner
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: nfs-provisioner
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: nfs-provisioner-runner
@hellokaton
hellokaton / README.md
Last active March 29, 2024 02:33
Go 的信号处理和优雅退出

每个平台的信号定义或许有些不同。下面列出了POSIX中定义的信号。 Linux 使用34-64信号用作实时系统中。 命令man 7 signal提供了官方的信号介绍。

在POSIX.1-1990标准中定义的信号列表

@Akagi201
Akagi201 / go-mod.md
Created December 17, 2018 02:27
[go-mod]

go mod 项目管理

go 1.11 有了对模块的实验性支持,大部分的子命令都知道如何处理一个模块,比如 run build install get list mod 子命令,第三方工具可能会支持的晚一些。

到 go 1.12 会删除对 GOPATH 的支持,go get 命令也会变成只能获取模块,不能像现在这样直接获取一个裸包。

可以用环境变量 GO111MODULE 开启或关闭模块支持,它有三个可选值:off、on、auto,默认值是 auto。

开启go mod机制

请选择go1.11以上版本

@adaroobi
adaroobi / vb-guest-additions.sh
Last active June 27, 2022 16:57
Install Oracle VirtualBox Guest additions via terminal CentOS7
# Find the appropriate version here http://download.virtualbox.org/virtualbox/
sudo VBOX_VERSION=6.0.4
sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -Uvh http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/d/dkms-2.6.1-1.el7.noarch.rpm
sudo yum -y install wget perl gcc dkms kernel-devel kernel-headers make bzip2
wget http://download.virtualbox.org/virtualbox/${VBOX_VERSION}/VBoxGuestAdditions_${VBOX_VERSION}.iso
sudo mkdir /media/VBoxGuestAdditions
@android10
android10 / oh-my-zsh-powerlevel9k-theme.md
Last active June 1, 2025 20:55
oh-my-zsh with PowerLevel9k on Arch Linux

Attention: This is DEPRECATED in favor of PowerLevel10K, I wrote an article about it:

Install oh-my-zsh with powerlevel9k theme on Arch Linux

This gist aims to facilitate the switching from bash to zsh as our defaut shell. We will be using oh-my-zsh with the powerful theme: Powerlevel9k. You will find all the links below. This process applies mainly for Arch Linux, but can be setup for any other distro (in theory :)). I'm also using Gnome Terminal and pacaur as package manager.