Skip to content

Instantly share code, notes, and snippets.

@aclisp
aclisp / cron.go
Last active November 2, 2023 08:38
优雅结束的定时任务
package job
import (
"fmt"
"git.yy.com/ihago/yalert/v2"
"git.yy.com/ihago/ylog"
"git.yy.com/ihago/ylog/zap"
"git.yy.com/ihago/yruntime"
"github.com/robfig/cron/v3"
"hago-room-srv-metrics2/util"
@xeoncross
xeoncross / unique_sequence_id.go
Created September 11, 2018 19:51
Trying to get a unique ID per instance by using UnixNano + a mutex lock: https://play.golang.org/p/q8OzAXzha3B
package main
import (
"fmt"
"sync"
"time"
)
type Sequence struct {
m sync.Mutex
@yougg
yougg / acfun_emoji.sh
Last active September 8, 2019 04:08
AC娘表情包图片下载脚本
#!/bin/bash
#AC娘表情包 01-54
#http://cdn.aixifan.com/dotnet/20130418/umeditor/dialogs/emotion/images/ac/01.gif?v=0.1
#匿名版表情包 01-40
#http://cdn.aixifan.com/dotnet/20130418/umeditor/dialogs/emotion/images/ais/01.gif?v=0.1
#AC新娘表情包 01-55
#http://cdn.aixifan.com/dotnet/20130418/umeditor/dialogs/emotion/images/ac2/01.gif?v=0.1
@guozi
guozi / ExpirationListener.java
Created August 22, 2018 05:36 — forked from jdonee/ExpirationListener.java
Spring Boot 2 + Spring Session 2 + Shiro 1.4 + Redis(Lettuce) Config
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.stereotype.Component;
import lombok.extern.slf4j.Slf4j;
/**
* Session过期监听
* @author Frank Zeng
*
{
"stats": {},
"api": {
"services": [
"StatsService"
],
"tag": "api"
},
"policy": {
"levels": {
@yevrah
yevrah / Upgrade vim
Last active September 25, 2023 05:11
Update to Vim8 on Centos 7
################################################################################
# Method 1: Install using rpm packages (credit to DarkMukke)
#
rpm -Uvh http://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el7.noarch.rpm
rpm --import http://mirror.ghettoforge.org/distributions/gf/RPM-GPG-KEY-gf.el7
# WARNING: removing vim-minimal uninstalls `sudo` if you skip the second step
# make sure to at least run `yum install sudo`
yum -y remove vim-minimal vim-common vim-enhanced
@martinklepsch
martinklepsch / README.md
Last active February 28, 2022 04:34
A very minimal Emacs configuration to get started with Emacs & Evil-mode

A Starting Point for using Emacs & Evil-mode

(I wrote a bit about why Emacs and Vim on my blog and thought it might be nice to give some starting point for people that want to try it.)

If you just want to play around with Emacs & Evil mode do the following:

  1. mkdir ~/.emacs.d/
  2. copy init.el into ~/.emacs.d/
  3. Download Emacs from http://emacsformacosx.com
@dmitshur
dmitshur / gist:6927554
Last active October 5, 2024 06:15
[Legacy GOPATH mode] How to `go get` private repos using SSH key auth instead of password auth.
@kitemao
kitemao / CustomRules.js
Last active February 23, 2020 06:22
使用fiddler构建动态数据桩------用fiddler按目录 自动下载保存 浏览器请求的文件.
import System;
import System.Windows.Forms;
import Fiddler;
// INTRODUCTION
// This is the FiddlerScript Rules file, which creates some of the menu commands and
// other features of Fiddler. You can edit this file to modify or add new commands.
//
// The original version of this file is named SampleRules.js and it is in the
// \Program Files\Fiddler\ folder. When Fiddler first starts, it creates a copy named
@hhyyy9
hhyyy9 / gist:3802833
Created September 29, 2012 01:23
利用正则表达式判断手机号码格式是否合法
- (BOOL)isMobileNumber:(NSString *)mobileNum
{
/**
* 手机号码
* 移动:134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188
* 联通:130,131,132,152,155,156,185,186
* 电信:133,1349,153,180,189
*/
NSString * MOBILE = @"^1(3[0-9]|5[0-35-9]|8[025-9])\\d{8}$";
/**