Skip to content

Instantly share code, notes, and snippets.

View zacker330's full-sized avatar
🌧️

Jack Zhai zacker330

🌧️
View GitHub Profile
@luxixing
luxixing / nginx-location
Created November 1, 2013 09:16
nginx location 匹配规则
1 普通匹配,遵循最长匹配规则,假设一个请求匹配到了两个普通规则,则选择匹配长度大的那个
例如:
location /{
[matches]
}
location /test{
[matches]
}
2 精确匹配
location = /{
@rb2k
rb2k / gist:8372402
Last active October 14, 2025 10:50
A jenkins script to clean up workspaces on slaves
// Check if a slave has < 10 GB of free space, wipe out workspaces if it does
import hudson.model.*;
import hudson.util.*;
import jenkins.model.*;
import hudson.FilePath.FileCallable;
import hudson.slaves.OfflineCause;
import hudson.node_monitors.*;
for (node in Jenkins.instance.nodes) {
@christopher-hopper
christopher-hopper / vm-resize-hard-disk.md
Last active July 24, 2025 03:22
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirutalBox.

Resize a Hard Disk for a Virtual Machine

Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.

Some assumptions

The following steps assume you've got a set-up like mine, where:

@morhekil
morhekil / nginx.conf
Created August 14, 2014 12:18
Full request/response body logging in nginx
http {
log_format bodylog '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" $request_time '
'<"$request_body" >"$resp_body"';
lua_need_request_body on;
set $resp_body "";
body_filter_by_lua '
@liyp
liyp / cassandra-cql.md
Created July 30, 2015 08:53
cassandra cql

Cassandra CQL 执行效率

目标

  • 对推送保存记录表push_app_task push_device_task的查询:
    1. 主KEY上的搜索(partitionKey和带上clusterKey的区别)
    2. 索引上的搜索(单个和多个的区别,单个索引上少值和多值的区别)
    3. 混合主Key和Index上的搜索
  1. 表上的聚集操作(计算count(*))和 迭代累加计数
@fideloper
fideloper / install_mysql.sh
Last active July 1, 2020 10:13
instal mysql5.7 non-interactive on ubuntu 14.04
#!/usr/bin/env bash
# This is assumed to be run as root or with sudo
export DEBIAN_FRONTEND=noninteractive
# Import MySQL 5.7 Key
# gpg: key 5072E1F5: public key "MySQL Release Engineering <[email protected]>" imported
apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 5072E1F5
echo "deb http://repo.mysql.com/apt/ubuntu/ trusty mysql-5.7" | tee -a /etc/apt/sources.list.d/mysql.list
@jmaxhu
jmaxhu / .git-commit-template.txt
Last active August 21, 2023 06:29 — forked from adeekshith/.git-commit-template.txt
一份建议的git commit模板
# <类型>: (类型的值见下面描述) <主题> (最多50个字)
# 解释为什么要做这些改动
# |<---- 请限制每行最多72个字 ---->|
# 提供相关文章和其它资源的链接和关键字
# 例如: Github issue #23
# --- 提交 结束 ---
# 类型值包含
@sivel
sivel / inventory2json.py
Last active December 19, 2023 01:54
Ansible inventory to dynamic inventory JSON output, accepts all inventory input formats
import sys
import json
from ansible.parsing.dataloader import DataLoader
try:
from ansible.inventory.manager import InventoryManager
A24 = True
except ImportError:
from ansible.vars import VariableManager
@gwsu2008
gwsu2008 / jenkins-ping-thread-config
Last active July 28, 2020 12:55
Jenkins Ping Thread
-Dhudson.remoting.Launcher.pingTimeoutSec=240
-Dhudson.remoting.Launcher.pingIntervalSec=0 (slave)
-Dhudson.slaves.ChannelPinger.pingIntervalSeconds=0 (master)
@MrCoder
MrCoder / zenuml.dsl
Last active April 18, 2018 02:25
DSL examples for Web Sequence Chrome Extension (Get the extension from https://chrome.google.com/webstore/detail/web-sequence/kcpganeflmhffnlofpdmcjklmdpbbmef?ref=gist)
// Hello World
ZenUML.Hello(World)
// Simple RESTful API implementation
BookController.get(bookId) {
BookService.get(bookId) {
BookRepository.findOne(bookId)
}
}