Skip to content

Instantly share code, notes, and snippets.

View defp's full-sized avatar

lidashuang defp

View GitHub Profile
@defp
defp / 判断一个数是否在树中出现.ss
Created September 19, 2011 12:54
程序设计方法14.2.1
;;contains-bt
;;二叉搜索树
(define (contains-bt num bt)
(cond
[(empty? bt) false]
[else (cond
[(= (node-ssn bt) num) true]
[(contains-bt num (node-left bt))true]
[(contains-bt num (node-right bt))true]
[else false]
@defp
defp / rename.sh
Created October 13, 2011 15:08
rename.sh
#/bin/bash
ls *.JPG >file.txt
for i in $(cat file.txt)
do
name=$(echo $i.jpg)
mv $i $name
done
##nginx.conf
user group;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
@defp
defp / pipe.c
Created May 27, 2012 06:52
linux pipe
#include <unistd.h>
#include <sys/types.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#define MAX_DATA_LEN 256
#define DELAY_TIME 1
int main(){
@defp
defp / .gitignore
Created May 27, 2012 07:49
linux simple shell
*.pyc
*~
*.[oa]
*.db
*.*~
# See http://help.github.com/ignore-files/ for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile ~/.gitignore_global
@defp
defp / sublime.sublime
Created June 15, 2012 14:04
sublime-key-map-jj
{ "keys": ["j","j"], "command": "exit_insert_mode",
"context":
[
{ "key": "setting.command_mode", "operand": false },
{ "key": "setting.is_widget", "operand": false }
]
},
{ "keys": ["j","j"], "command": "hide_auto_complete", "context":
[
@defp
defp / 0-ubuntu-server.markdown
Created September 24, 2012 08:45
deploy with capistrano

准备工作

byobu 基于screen或tmux的终端工作

sudo apt-get install byobu curl

在终端启动

byobu # F6 可以让进程在后台运行`
@defp
defp / mysql.markdown
Created October 25, 2012 01:39
mysql-command

socket位置

mysql_config --socket

输出

/var/run/mysqld/mysqld.sock

mysql备份数据库

@defp
defp / Makefile
Created November 9, 2012 06:54
makefile for rsync
SSH_PORT = 80
SSH_USER = lidashuang@210.44.176.208
SSH_USERPATH = ~/scrapbook
DIR = ~/scrapbook
rsync:
rsync -avze 'ssh -p $(SSH_PORT)' --delete $(DIR) $(SSH_USER):$(SSH_USERPATH)
@defp
defp / 157.clj
Created November 12, 2012 15:18
4clojure
(fn [seq]
(map-indexed (fn [id val] (vector val id)) seq))