This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
def rob(x): | |
print 'rob: ', x | |
return most(x, 0, 2) | |
def most(x, n, r): | |
l = len(x) | |
pre = 0 | |
pre_keys = [] | |
for i in range(0, r): # nums need to count |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$str = "*4\r\n$-1\r\n$2\r\nb2\r\n$2\r\nb3\r\n$2\r\nb1\r\n" | |
."*5\r\n$2\r\na2\r\n$6\r\n*:+-:$\r\n$2\r\na1\r\n$2\r\na3\r\n$-1\r\n*0\r\n"; | |
$r = read_pipeline_str_v2($str); | |
print_r($r); | |
function read_pipeline_str_v2($str) | |
{ | |
$stat_strs = ['-', '+']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun v-php-doc (func-name) | |
"show php doc by region" | |
; take your php html doc file to doc-dir | |
; need nero https://code.google.com/p/nero-el/ | |
; about browser: http://www.emacswiki.org/emacs/CategoryWebBrowser | |
(interactive (list | |
(read-string (format "Enter the word (%s): " | |
(thing-at-point 'symbol) | |
) | |
nil 1 (thing-at-point 'symbol)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env expect | |
set host [lindex $argv 0] | |
set user [lindex $argv 1] | |
set passwd [lindex $argv 2] | |
spawn ssh $user@$host | |
expect "*password:" | |
send $passwd | |
send "\r" | |
interact |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Vince | |
class Moon | |
#Get a circle | |
def getCircle(r, p = false) | |
# (x - a)^2 + ( y -b)^2 = r^2 | |
range = 2 * r + 1 | |
circle = Array.new(range){Array.new(range, 1)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
def map_init(c) | |
arr = [] | |
c[1].times do | |
arr.push Array.new(c[0], 0) | |
end | |
arr | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Translating by ydcv | |
(defun ydcv (string) | |
"vincen's elisp ydcv" | |
(interactive "sEnter the word: ") | |
(shell-command (concat "~/bin/ydcv '" string "'")) | |
) | |
;; Checking php syntax by "php -l" | |
(defun plint () | |
"Checking php syntax by php -l" | |
(interactive) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(global-linum-mode 1) | |
(setq make-backup-files nil) | |
(add-to-list 'load-path "~/plugin/emacs/mode") | |
(load "php-mode") | |
(load "markdown-mode") | |
(load "coffee-mode") | |
(add-to-list 'auto-mode-alist '("\\.coffee$" . coffee-mode)) | |
(add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode)) |