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
;;; define-key in a easy way -*- emacs-lisp -*- | |
;; Copyright (C) 2010 Tao Peng <ptpttt@gmail.com> | |
;; Author: Tao Peng <ptpttt@gmail.com> | |
;; Keywords: key | |
;; This file is NOT part of GNU Emacs. | |
;; This is free software; you can redistribute it and/or modify it under |
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
;; Act on lines if mark is not active | |
(defmacro defadvice-act-line-as-region-if-no-mark (orig-function) | |
`(defadvice ,orig-function (before act-on-line-if-no-mark activate compile) | |
,(format "Like `%s', but acts on the current line if mark is not active." orig-function) | |
(interactive | |
(if mark-active | |
(list (region-beginning) (region-end)) | |
(list (line-beginning-position) (line-beginning-position | |
(+ 1 (prefix-numeric-value current-prefix-arg)))))))) |
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 Module1 | |
Function partition(ByRef a As Array, ByVal l As Integer, ByVal r As Integer) | |
Dim j As Integer = l | |
Dim p As Integer = a(r) | |
For i = l To r - 1 | |
If a(i) < p Then | |
Dim tmp As Integer = a(i) | |
a(i) = a(j) | |
a(j) = tmp |
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
#include <stdio.h> | |
#define MAX_CHAR 255 | |
int main(void) | |
{ | |
int cc[MAX_CHAR+1]; | |
char c; | |
int max_cc = 0; | |
int i = 0; |
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 bits(n): | |
bstr = "" | |
while (n>0): | |
bstr = str(n%2) + bstr | |
n = n / 2 | |
return bstr | |
if __name__ == '__main__': |
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
#!/bin/bash | |
curl -s http://feed.feedsky.com/kxtfm|grep -o \"http://.*\\.mp3\"|xargs wget -N |
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
(defvar ido-recentf-list nil | |
"internal use") | |
(defun pt-recentf-ido-find-file () | |
"Find recently opened files using ido-mode." | |
(interactive) | |
(recentf-cleanup) | |
(setq ido-recentf-list nil) | |
(let (records suffix) | |
(dolist (file recentf-list) |
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
#include<stdio.h> | |
#include<assert.h> | |
int binary_search(int a[], int b, unsigned int length) | |
{ | |
if (length==0) return -1; | |
unsigned int mean = length/2; | |
if (b==a[mean]) | |
return b; | |
else if (b<a[mean]) |
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 | |
# -*- coding: utf-8 -*- | |
from __future__ import division | |
class Stack(list): | |
@property | |
def top(self): | |
if len(self)==0: | |
return None |
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
Sub assign_level() | |
Dim pFLayer As IFeatureLayer | |
Dim pMxDoc As IMxDocument | |
Set pMxDoc = ThisDocument | |
Set pFLayer = pMxDoc.FocusMap.Layer(0) | |
Dim pSel As IFeatureSelection | |
Set pSel = pFLayer | |
Dim pSelectionSet As ISelectionSet | |
Set pSelectionSet = pSel.SelectionSet | |
Dim OIDList(1024) As Long |
OlderNewer