Skip to content

Instantly share code, notes, and snippets.

包子 iBaozi

Block or report user

Report or block iBaozi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@iBaozi
iBaozi / gist:45e9f3a3e4487104a4b83c25e1eb853f
Created Dec 11, 2017 — forked from mattetti/gist:3798173
async fetching of urls using goroutines and channels
View gist:45e9f3a3e4487104a4b83c25e1eb853f
package main
import (
"fmt"
"net/http"
"time"
)
var urls = []string{
"http://pulsoconf.co/",
@iBaozi
iBaozi / auto_update.md
Last active Nov 7, 2016
gitlab 自动发布
View auto_update.md

自动更新代码

功能

该功能通过监听 git push 事件,触发A服务器指定目录 git pull。
比如 forumsbaozi 分支在任意环境下成功push后,会在A服务器的 /data/web/framework/trunk/ baozi/ forums 目录执行 git pull

部署

在A服务器运行 auto_update.py。
在 gitlab,添加 web hook: http://A服务器IP:8003

View md5.as
/*
Adobe Systems Incorporated(r) Source Code License Agreement
Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved.
Please read this Source Code License Agreement carefully before using
the source code.
Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable copyright license, to reproduce,
prepare derivative works of, publicly display, publicly perform, and
@iBaozi
iBaozi / vz_checker.py
Created Dec 5, 2015
A script to show OpenVZ resource message friendly
View vz_checker.py
#!/usr/bin/env python
#-*- coding:utf-8 -*-
'''
@author: snooda
@website: www.snooda.com
@License: GNU GPL v3
A script to show OpenVZ resource message friendly
'''
import sys
@iBaozi
iBaozi / vzfree.c
Created Oct 28, 2015
openvz 内存
View vzfree.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
struct resource_t {
char name[32];
long long held;
long long maxheld;
long long barrier;
@iBaozi
iBaozi / ReadMe.md
Last active Aug 30, 2019
redis 查看指定key 占用大小。用复制,查看增量方法,注意不要用于过大的key
View ReadMe.md

#步骤(How to use it)

  1. 保存脚本到(Save script as ) redis_size.lua
  2. 注册脚本 (Load script)
    redis-cli -h 192.168.1.1 -p 6371 script load "$(cat redis_size.lua)"
  3. 调用(Call it)
    evalsha 78331e1d4741cad34084d357e19ce6dbca8e202e 0 test_key // 注意与上步返回的一致
View pic2ascii.py
__author__ = 'baozi'
import Image
img_file = '1.jpg'
proportion = 0.3
View pic2mc.py
__author__ = 'baozi'
import Image,glob,os,colorsys
img_file = '1.jpg'
img_file_new = 'douwa_new.png'
direct = 'h'
z = 1
View Missing Number.js
/**
* @param {number[]} nums
* @return {number}
*/
function find(nums, v) {
for (var j in nums) {
if (v == nums[j]) {
return true
}
View cities.json
{"DZA": {"0": {"AAE": {"n": "\u5b89\u7eb3\u5df4"}, "BAT": {"n": "\u5df4\u7279\u7eb3"}, "ATE": {"n": "\u827e\u56e0\u00b7\u8482\u59c6\u5c1a\u7279"}, "MIL": {"n": "\u5bc6\u62c9"}, "GUE": {"n": "\u76d6\u5c14\u9a6c"}, "BEC": {"n": "\u8d1d\u6c99\u5c14"}, "BOR": {"n": "\u5e03\u5c14\u5409\u00b7\u5e03\u963f\u96f7\u91cc\u5409"}, "TIP": {"n": "\u8482\u5df4\u624e"}, "BOU": {"n": "\u5e03\u8fc8\u5fb7\u65af"}, "TIS": {"n": "\u8482\u65af\u59c6\u897f\u52d2\u7279"}, "TIN": {"n": "\u5ef7\u675c\u592b"}, "NAA": {"n": "\u7eb3\u963f\u9a6c"}, "BIS": {"n": "\u6bd4\u65af\u514b\u62c9"}, "GHA": {"n": "\u76d6\u5c14\u8fbe\u8036"}, "REL": {"n": "\u8d6b\u5229\u8d5e"}, "BOA": {"n": "\u5e03\u4f9d\u62c9"}, "ILL": {"n": "\u4f0a\u5229\u9f50"}, "SKI": {"n": "\u65af\u57fa\u514b\u8fbe"}, "TIA": {"n": "\u63d0\u4e9a\u96f7\u7279"}, "SAI": {"n": "\u8d5b\u4f0a\u8fbe"}, "SET": {"n": "\u585e\u8482\u592b"}, "TEB": {"n": "\u7279\u8d1d\u8428"}, "SAH": {"n": "\u82cf\u514b\u00b7\u963f\u8d6b\u62c9\u65af"}, "SBA": {"n": "\u897f\u8fea\u8d1d\u52d2\u963f\u8d1d\u65a
You can’t perform that action at this time.