Skip to content

Instantly share code, notes, and snippets.

@iOS0x00
iOS0x00 / gist:8312332
Created January 8, 2014 05:39
简单的tmux配置,支持鼠标操作
set -g prefix C-a
set-window-option -g mode-keys vi
set-window-option -g utf8 on
set -g mode-mouse on
set -g mouse-select-pane on
set -g mouse-resize-pane on
set -g mouse-select-window on
@iOS0x00
iOS0x00 / mqpublisher.py
Created January 28, 2015 09:17
RabbitMQ pika的封装,支持多台node负载以及keepalive
# -*- coding: utf-8 -*-
# vim: ts=4:sw=4:expandtab
"""
RabbitMQ 库封装,主要是针对多台rabbitmq服务器的HA支持, 另外对执行动作时的心跳检测。
"""
import os
import pika
@iOS0x00
iOS0x00 / gist:8648065
Created January 27, 2014 12:54
sourcetree
#! /bin/bash
if [[ -f /Applications/MacVim.app/Contents/MacOS/Vim ]]
then
# bypass mvim for speed
VIMPATH='/Applications/MacVim.app/Contents/MacOS/Vim -g -dO -f'
elif [[ -f /usr/local/bin/mvim ]]
then
# fall back to mvim
VIMPATH='mvim -d -f'
else
@iOS0x00
iOS0x00 / gist:8313942
Created January 8, 2014 09:15
批处理
@echo off
set regpath=HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
set javahome=C:\Program Files\Java\jdk1.6.0_10
rem LPY
echo.
echo ************************************************************
echo * *
echo * JDK 系统环境变量设置 *
echo * *
echo ************************************************************
@iOS0x00
iOS0x00 / gist:8313096
Created January 8, 2014 07:32
pretty tornado log
from tornado.log import enable_pretty_logging
enable_pretty_logging()
#coding: utf-8
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import sys
QTextCodec.setCodecForTr(QTextCodec.codecForName("utf8"))
class StandardDialog(QDialog):
def __init__(self,parent=None):
@iOS0x00
iOS0x00 / gist:8128552
Created December 26, 2013 01:20
 连接mssql数据库查询的sample
import clr
clr.AddReference('System.Data')
from System.Data.SqlClient import SqlConnection, SqlParameter
conn_string = 'data source=<machine>; initial catalog=<database>; trusted_connection=True'
connection = SqlConnection(conn_string)
connection.Open()
command = connection.CreateCommand()
command.CommandText = 'select id, name from people where group_id = @group_id'
command.Parameters.Add(SqlParameter('group_id', 23))
@iOS0x00
iOS0x00 / demo.py
Created December 1, 2013 13:55
自定义路径的BaseHttpServer
import os
import posixpath
import urllib
import socket
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
ROUTES = (
['', '/Users/neil/workspaces/www-data/'],
)
@iOS0x00
iOS0x00 / vi.html
Created November 22, 2013 05:15
左侧栏目带点击隐藏功能Jquery版本
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
* {
margin:0;
padding:0;
#******************************************************************************
# Copyright (c) 2011 Trevor Harwell
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Trevor Harwell - initial implementations
#******************************************************************************