Skip to content

Instantly share code, notes, and snippets.

View SoulSu's full-sized avatar
🎯
Focusing

soul SoulSu

🎯
Focusing
View GitHub Profile
@SoulSu
SoulSu / squeue.go
Last active August 31, 2016 08:57
使用Golang 实现简单队列
package main
import (
"errors"
"fmt"
"log"
"runtime"
"sync"
"time"
)
@SoulSu
SoulSu / route.php
Created October 12, 2016 08:21
Laravel route
<?php
Route::group([], function () {
Route::any('/{controller?}/{action?}', function($controller='', $action=''){
if (empty($controller)) {
return 'welcome!';
}else {
$controller = "App\\Http\\Controllers\\".ucfirst($controller).'Controller';
return App::make($controller)->$action();
}
@SoulSu
SoulSu / api.go
Created June 15, 2017 14:13
更优雅的关闭tcp链接
var tempDelay time.Duration
for {
conn, err := listener.Accept()
if err != nil {
if ne, ok := err.(net.Error); ok && ne.Temporary() {
if tempDelay == 0 {
tempDelay = 5 * time.Millisecond
} else {
tempDelay *= 2
}
@SoulSu
SoulSu / ping.php
Created July 13, 2017 15:06
简单实现的ping echo 程序
<?php
$host = "127.0.0.1";
$_type = chr(8);
$type = pack('c', 8);
$code = pack('c', 0);
@SoulSu
SoulSu / Jenkinsfile
Created August 14, 2018 13:26
Golang build with jenkins pipleline
node {
// 使用的Go版本号
def root = tool name: 'Go1103', type: 'go'
// 使用的第三方包目录
def sysGoVendorPath = "/opt/govendor"
// 系统编译目录
def projBuildPath = "${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/"
// 项目构建目录
def goBuildPath = "${projBuildPath}src/quoteserver/quotereal"
// 相对编译输出文件夹名称
@SoulSu
SoulSu / aesecb.go
Last active August 3, 2022 07:36
golang aes ecb pKCS5Padding like java 3DES_ECB_PKCS5Padding
package idcardocr
import (
"bytes"
"crypto/cipher"
"crypto/des"
)
// 3DES加密
@SoulSu
SoulSu / interface.go
Created November 27, 2018 10:10
Golang 实现一个接口后 方法需要传数组怎么办
package main
import (
"fmt"
"reflect"
)
type Aer interface {
GetVal() string
SetVal(int)
@SoulSu
SoulSu / ssl.go
Created December 18, 2018 11:49
使用Golang生成证书 公钥 私钥
package tools
import (
"bytes"
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/asn1"
"encoding/pem"
@SoulSu
SoulSu / gaauth.go
Created December 18, 2018 11:52
生成谷歌验证器
package tools
// 谷歌验证
// clone from: https://github.com/928799934/googleAuthenticator
import (
"crypto/hmac"
"crypto/sha1"
"encoding/base32"
"encoding/hex"
"errors"
@SoulSu
SoulSu / terminator
Created March 23, 2019 07:31
~/.config/terminator/config terminator 配置
[global_config]
handle_size = -3
enabled_plugins = CustomCommandsMenu, LaunchpadCodeURLHandler, APTURLHandler, LaunchpadBugURLHandler
title_transmit_fg_color = "#000000"
suppress_multiple_term_dialog = True
title_transmit_bg_color = "#3e3838"
inactive_color_offset = 1.0
[keybindings]
[profiles]
[[default]]