Skip to content

Instantly share code, notes, and snippets.

View slow-is-fast's full-sized avatar

slow-is-fast slow-is-fast

View GitHub Profile
@slow-is-fast
slow-is-fast / 佛祖保佑,哈哈
Created June 6, 2016 05:50 — forked from tailnode/佛祖保佑,哈哈
佛祖保佑,永不宕机,永无bug
//
// _oo8oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/'==='\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||_ \
@slow-is-fast
slow-is-fast / agnoster.md
Created July 9, 2016 07:38 — forked from petres/agnoster.md
Zsh (oh-my-zsh) Agnoster Theme Adaption for SVN

Agnoster Adaption

The SVN plugin of the oh-my-zsh ZSH distribution is not working with the agnoster theme, because it's simple not used in the prompt of the theme. Here two adaption of the theme file (themes/agnoster.zsh-theme) are listed, which are showing a nice prompt when you are in a SVN working directory.

  • Using the SVN plugin (with dirty symbol)
prompt_svn() {
  local rev branch
  if in_svn; then
@slow-is-fast
slow-is-fast / counting_nginx.py
Created July 15, 2016 14:15 — forked from orangle/counting_nginx.py
使用nginx post_action参数来统计文件下载情况,从而统计用户下载文件完整性
#!/usr/bin/python
#-*- coding:utf-8 -*-
############################
#File Name: counting_file.py
#Author: orangleliu
#Mail: orangleliu@gmail.com
#Created Time: 2015-03-11 16:41:05
#License: MIT
############################
'''
@slow-is-fast
slow-is-fast / nginxvarcore.md
Created July 16, 2016 03:27 — forked from esfand/nginxvarcore.md
Nginx Variables

Embedded Variables

The ngx_http_core_module module supports embedded variables with names matching the Apache Server variables. First of all, these are variables representing client request header fields, such as $http_user_agent, $http_cookie, and so on. Also there are other variables:

  • $arg_name
    argument name in the request line
@slow-is-fast
slow-is-fast / validation.php
Created October 16, 2016 08:59 — forked from chareice/validation.php
Localization Validation Message For Chineses With Laravel 5
<?php
use Symfony\Component\Yaml\Yaml;
return Yaml::parse(file_get_contents(base_path().'/resources/lang/zh_cn/validation.yml'));
@slow-is-fast
slow-is-fast / gist:e0581ccb10af9d606f4838261b152d52
Created November 14, 2016 10:19 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@slow-is-fast
slow-is-fast / webdev_tools.md
Created November 14, 2016 10:20 — forked from ctkjose/webdev_tools.md
Web Development Tools
@slow-is-fast
slow-is-fast / pg-running-queries.sql
Created November 22, 2017 08:40 — forked from JoshuaGross/pg-running-queries.sql
List running queries in PostGres
select * from pg_stat_activity;
@slow-is-fast
slow-is-fast / redis_key_sizes.sh
Last active December 20, 2017 02:46 — forked from epicserve/redis_key_sizes.sh
A simple script to print the size of all your Redis keys. #redis
#!/usr/bin/env bash
# This script prints out all of your Redis keys and their size in a human readable format
# Copyright 2013 Brent O'Connor
# License: http://www.apache.org/licenses/LICENSE-2.0
human_size() {
awk -v sum="$1" ' BEGIN {hum[1024^3]="Gb"; hum[1024^2]="Mb"; hum[1024]="Kb"; for (x=1024^3; x>=1024; x/=1024) { if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break; } } if (sum<1024) print "1kb"; } '
}
@slow-is-fast
slow-is-fast / MultiPartFromStrings.php
Created August 16, 2018 09:58 — forked from iansltx/MultiPartFromStrings.php
Multipart file uploads in PHP from strings
<?php
/**
* PHP's curl extension won't let you pass in strings as multipart file upload bodies; you
* have to direct it at an existing file (either with deprecated @ syntax or the CURLFile
* type). You can use php://temp to get around this for one file, but if you want to upload
* multiple files then you've got a bit more work.
*
* This function manually constructs the multipart request body from strings and injects it
* into the supplied curl handle, with no need to touch the file system.