Skip to content

Instantly share code, notes, and snippets.

@jqlblue
jqlblue / 在fedora16上搭建lisp环境
Created June 27, 2012 08:08
在fedora16上搭建lisp环境
有两种方案,先说比较复杂的。
1 Emacs+SLIME+SBCL
emacs的安装不说了,没有的yum就好。
sbcl(Steel Bank Common Lisp),是一种高性能的common lisp编译器,yum即可。
slime是emacs的common lisp模式,是emacs的一个插件,下载下来备用。
然后,在emacs的配置文件中加入
(setq inferior-lisp-program "/usr/bin/sbcl")
(require 'slime)
(slime-setup '(slime-fancy))
重启emacs,也可以配置不重启让配置文件生效。
@jqlblue
jqlblue / gist:3245647
Created August 3, 2012 08:05
用户随机分组
//将用户进行随机分组,每组6个
$all = array(
'x1','x2','x3','x4',
'x5','x6','x7','x8',
);
define('GROUP_MAX', 6);
$groupCount = getGroupCount(count($all));
$groups = initGroups($groupCount);
shuffle($all);
@jqlblue
jqlblue / emacs pycheckers
Created March 24, 2013 13:41
emacs pycheckers
#!/bin/bash
epylint "$1" 2>/dev/null
pyflakes "$1"
pep8 --ignore=E221,E701,E202 --repeat "$1"
true
;; Org mode settings
(add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . org-mode))
(require 'org-install)
(require 'ob-ditaa)
(require 'org-latex)
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
@jqlblue
jqlblue / check-php-compatibility
Last active December 19, 2015 10:19
check php compatibility
#!/bin/sh
#use /usr/sh /path/script.sh > report.txt
SOURCE_ROOT='/source/code/directory'
PHP_BIN='/usr/bin/php5.5'
for file in $(find ${SOURCE_ROOT} -type f -iname '*.php'); do
check_syntax=$(${PHP_BIN} -d error_reporting=E_ALL -l $file | grep -v 'No syntax errors detected')
done
@jqlblue
jqlblue / php-5.5-install.sh
Created August 10, 2013 01:37
php 5.5 install guide
#!/bin/bash
PHP_VERSION="5.5.0"
yum -y install \
curl-devel.x86_64 \
libmcrypt-devel.x86_64 \
libxml2-devel.x86_64 \
libtool-ltdl-devel.x86_64 \
pcre-devel.x86_64 \
@jqlblue
jqlblue / trace-url
Last active December 23, 2015 17:09
trace url
#!/bin/bash
#
# curl wrapper returning timing information.
# curl format adapted from
# http://digdeeply.org/archives/05102012.html
# Example usage:
# $ trace-url http://www.apple.com
# $ time trace-url http://www.apple.com -v
set -e
@jqlblue
jqlblue / sentry.conf.py
Created December 18, 2013 06:38
sentry config example
# This file is just Python, with a touch of Django which means you
# you can inherit and tweak settings to your hearts content.
from sentry.conf.server import *
import os.path
CONF_ROOT = os.path.dirname(__file__)
DATABASES = {
'default': {
# You can swap out the engine for MySQL easily by changing this value
@jqlblue
jqlblue / sentry-php-client.php
Created December 18, 2013 08:57
sentry php client for collection php5.5 error log
<?php
class Client
{
private static $_logFile;
private static $_parseOffset;
private static $_dsn;
private static $_logtailBin;
private static $_maxItem;
public static function run($options)
{
@jqlblue
jqlblue / sentry-nginx.conf
Last active December 31, 2015 17:19
sentry nginx config for proxy and limit req
user nobody;
worker_processes auto;
error_log logs/error.log notice;
worker_rlimit_nofile 65535;
pid /var/run/nginx.pid;
events {
accept_mutex off;