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/python | |
import os | |
import sys | |
if len(sys.argv) == 1: | |
print "./template <filename> <package name> <imports>" | |
exit(0) | |
filename=sys.argv[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/python | |
# only has seconds resolution | |
class Profile: | |
def profile_start(self): | |
self.start = time.gmtime() | |
def profile_stop(self): | |
self.stop = time.gmtime() | |
def profile_display(self): |
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/python | |
import psutil | |
print "num cpus " + str(psutil.cpu_count(logical=False)) | |
print "num cpu (total) " + str(psutil.cpu_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
#!/usr/bin/python | |
class Lists: | |
def __init__(self): | |
self.list = [] | |
def list_head(self): | |
return self.list[0] | |
def list_tail(self): | |
return self.list[len(self.list) - 1] | |
def list_add_tail(self, elem): |
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 <sys/un.h> | |
#include <sys/socket.h> | |
int get_sock_name(int fd, char *name, int name_len) | |
{ | |
int ret | |
socklen_t len = sizeof(struct sockaddr_un); | |
struct sockaddr_un s; | |
ret = getsockname(fd, (struct sockaddr *)&s, &len); |
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 <stdlib.h> | |
#include <string.h> | |
#include <time.h> | |
#include <sys/time.h> | |
char alphabets[] = | |
{'a', 'A', | |
'b', 'B', | |
'c', 'C', |
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 <stdlib.h> | |
FILE *fp; | |
char buffer[1000]; | |
struct fstypes { | |
int vfs; | |
char *filesystem; | |
} fs_types[30]; |
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 <stdlib.h> | |
#include <signal.h> | |
#include <sys/signalfd.h> | |
int segv_handle() | |
{ | |
printf("segv\n"); | |
exit(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
#include <unistd.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <fcntl.h> | |
int rand_gen_int() | |
{ | |
int ret; | |
int fd; | |
int number = 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
#include <stdio.h> | |
#include <sys/socket.h> | |
int opt = -1; | |
socklen_t optlen = sizeof(opt); | |
int main(int argc, char **argv) | |
{ | |
int type; |
OlderNewer