Skip to content

Instantly share code, notes, and snippets.

View zhu2688's full-sized avatar
🎯
Focusing

2688 zhu2688

🎯
Focusing
  • 中国,广东,深圳
View GitHub Profile

基础知识

  • 计算机软硬件基础
  • 计算机网络
  • 操作系统
  • 数据结构和算法
  • 设计模式
  • 以及其他各种你应该懂的东西

前端开发

  • 前端标准/规范
@hwdsl2
hwdsl2 / .MOVED.md
Last active December 28, 2016 07:16
Ghost Blog Auto Setup Script with Nginx and Naxsi
@Andrew8xx8
Andrew8xx8 / Gemfile
Created June 14, 2013 10:32
Example of API with ransack search and kaminari paginate.
gem 'kaminari'
gem 'ransack'
@cpuguy83
cpuguy83 / loading_spinner.coffee
Last active August 30, 2020 13:49
Simple loading spinner for long requests with turbolinks and bootstrap modal
@PageSpinner =
spin: (ms=500)->
@spinner = setTimeout( (=> @add_spinner()), ms)
$(document).on 'page:change', =>
@remove_spinner()
spinner_html: '
<div class="modal hide fade" id="page-spinner">
<div class="modal-head card-title">Please Wait...</div>
<div class="modal-body card-body">
<i class="icon-spinner icon-spin icon-2x"></i>
@ck-on
ck-on / ocp.php
Last active March 4, 2026 04:51
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)#ocp #php #opcache #opcode #cache #zend #optimizerplus #optimizer+
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.7
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.7 2015-09-01 regex fix for PHP7 phpinfo
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
@n5i
n5i / encoding.php
Created November 12, 2012 11:51
Encoding detection class
<?php
class Encoding {
protected static $win1252ToUtf8 = array(
128 => "\xe2\x82\xac",
130 => "\xe2\x80\x9a",
131 => "\xc6\x92",
132 => "\xe2\x80\x9e",
@naokij
naokij / spider-killer.sh
Created October 24, 2012 03:24
根据nginx日志文件过滤spider
#! /bin/bash
LOGFILE=/var/log/nginx/access.log
PREFIX=/etc/spiders
#日志中大部分蜘蛛都有spider的关键字,但是百度的不能封,所以过滤掉百度
grep 'spider' $LOGFILE |grep -v 'Baidu' |awk '{print $1}' >$PREFIX/ip1.txt
# 封掉网易的有道
grep 'YoudaoBot' $LOGFILE | awk '{print $1}' >>$PREFIX/ip1.txt
#封掉雅虎
grep 'Yahoo!' $LOGFILE | awk '{print $1}' >>$PREFIX/ip1.txt
# 过滤掉信任IP
@mimosz
mimosz / nginx.conf
Created August 31, 2012 01:59
nginx + unicorn + padrino on ubuntu
# sudo ln -s ~/nginx.conf unicorn.conf
upstream app_server {
server unix:/tmp/unicorn_padrino.sock fail_timeout=0;
}
server {
listen 80;
charset utf-8;
server_name db.innshine.com;
@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active April 25, 2026 07:50
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1