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
#authorized keys file name | |
AK=authorized_keys | |
#enabled pub key dir | |
ENABLED=enabled_keys | |
#disabled pub key dir | |
DISABLED=disabled_keys | |
if [[ $# = 0 ]] | |
then | |
printf "Usage:\n %s to_be_removed.pub\n" "$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
var Base = { | |
create: function(attrs){ | |
var o=this.clone(); | |
o.init(attrs); | |
return o; | |
}, | |
clone: function() { | |
var o={}; | |
for(var i in this) | |
if (this.hasOwnProperty(i)) |
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<string.h> | |
#include<ctype.h> | |
struct node{ | |
int num; | |
char *p; | |
struct node *next; | |
}; |
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
''' | |
Infix calculator | |
First tokenize infix expression, | |
then transform it into postfix, | |
then calculate it. | |
E.g.: | |
9 - 5 + 2 * 3 | |
=> 9 5 - 2 3 * + | |
''' | |
import re |
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
EGIN { | |
FIELD_LIST = "Field1,Field2,Field3"; # fields definition, in order | |
split(FIELD_LIST, fields, ","); | |
} | |
{ | |
pos = find(fields, $1); | |
if (pos == 0) { | |
print("unexpected field " $1); | |
exit 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
#include <stdio.h> | |
#include <unistd.h> | |
#include <string.h> | |
#include <time.h> | |
#include <stdlib.h> | |
#define MAXLINE 1024 | |
#define DATE_FORMAT "%Y-%m-%d %H:%M:%S" | |
#define GAP_IN_SEC 2 |
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
#-*- coding: utf8 -*- | |
''' | |
Examples of advanced Python features: | |
- metaclass | |
- descriptor | |
- generator/forloop | |
''' | |
from __future__ import print_function | |
import sys |
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 <string.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
/* | |
> becomes ++p; | |
< becomes --p; | |
+ becomes ++*p; | |
- becomes --*p; |
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
#-*- coding:utf8 -*- | |
from __future__ import print_function | |
import sys | |
import time | |
if sys.version_info < (3,0): | |
range = xrange |
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
#-*- coding: utf8 -*- | |
def isPrime(num, ps): | |
for i in ps: | |
if num%i == 0: | |
return False | |
if i**2 > num: | |
break | |
return True |
OlderNewer