Skip to content

Instantly share code, notes, and snippets.

@achun
achun / psam.go
Created April 15, 2013 08:27
测试 GoLang 下,指针,map,struct,数组,对象点操作"."
package main
import (
"fmt"
"runtime"
)
type LogHour struct {
pv uint32
}
@achun
achun / grace.go
Created May 5, 2013 07:23 — forked from rcrowley/grace.go
Go 语言中实现优雅的停止程序
package main
import (
"log"
"net"
"os"
"os/signal"
"sync"
"syscall"
"time"
@achun
achun / rpn.go
Last active December 6, 2019 11:06
Go 四则运算词法解析相关 由中缀表达式构建AST 逆波兰序列生成
//ReversePolishnotation,RPN
//逆波兰表达式相关
//lexer 是一个中缀数学四则计算表达式词法解析器
package rpn
import (
"errors"
)
type Token int
@achun
achun / macimage.go
Created March 14, 2014 03:44
Mobile Atlas Creator sqlitdb 图片导出
package main
import (
"flag"
"fmt"
"os"
"path/filepath"
"github.com/cheggaaa/pb"
"github.com/typepress/db"
@achun
achun / gorun.go
Created March 14, 2014 07:56
build and run 合体技. 来自 Go编程语言群成员 四叶草 发的 gorun 代码.
package main
import (
"log"
"os"
"os/exec"
"path/filepath"
)
func main() {
@achun
achun / gox.text
Last active May 20, 2021 20:07
go get golang.org/x
go get -u golang.org/x/crypto/bcrypt
go get -u golang.org/x/crypto/blowfish
go get -u golang.org/x/crypto/bn256
go get -u golang.org/x/crypto/cast5
go get -u golang.org/x/crypto/curve25519
go get -u golang.org/x/crypto/hkdf
go get -u golang.org/x/crypto/md4
go get -u golang.org/x/crypto/nacl/box
go get -u golang.org/x/crypto/nacl/secretbox
go get -u golang.org/x/crypto/ocsp
@achun
achun / htmlLex.js
Created December 23, 2014 08:56
合法 html 文本进行词法解析
var LOOP = 'LOOP' + Math.random(),
BREAK = 'BREAK' + Math.random()
/**
htmlLex 对合法 html 文本进行词法解析.
参数:
合法 html 文本
*/
function htmlLex() {
var pos, m, k, v, html, fn
@achun
achun / WebEvents.js
Created January 1, 2015 04:18
Everyone to improve
// https://developer.mozilla.org/en-US/docs/Web/Events
(function(global) {
"use strict"
global.StandardEvents = {
"Animation": {
"animationend": {
"url": "https://developer.mozilla.org/en-US/docs/Web/Events/animationend",
"Specification": "CSS Animations",
"Interface": "AnimationEvent",
"Bubbles": true,
@achun
achun / gulpfile.js
Last active January 19, 2016 13:48
gulp + webpack
var batch = require('gulp-batch');
var gulp = require('gulp');
function getPackageJson() {
var fs = require('fs');
return JSON.parse(fs.readFileSync('./package.json', 'utf8'));
};
gulp.task('bump', function(cb) {
var tag = require('minimist')(process.argv.slice(2)).tag || 'patch';
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: zxx
file_extensions:
- zxx
first_line_match: "-[*]-( Mode:)? Zxx -[*]-"
scope: source.zxx
contexts: