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
/*This is the sample program to notify us when the file /tmp/myinput is modified */ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <sys/types.h> | |
#include <linux/inotify.h> | |
#define EVENT_SIZE ( sizeof (struct inotify_event) ) | |
#define EVENT_BUF_LEN ( 1024 * ( EVENT_SIZE + 16 ) ) |
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
/*This is the sample program to notify us for the file creation and file deletion takes place in “/tmp” directory*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <sys/types.h> | |
#include <linux/inotify.h> | |
#define EVENT_SIZE ( sizeof (struct inotify_event) ) | |
#define EVENT_BUF_LEN ( 1024 * ( EVENT_SIZE + 16 ) ) |
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
int readoneline(char *fname){ | |
static char line[256]; | |
FILE *fd=fopen(fname,"r"); | |
if (fd==NULL) | |
return NULL; | |
if (fgets(line,sizeof(line),fd)==NULL){ | |
fclose(fd); | |
retrun NULL; | |
} | |
line[sizeof(line) - 1] = '\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 <stdlib.h> | |
#include <unistd.h> | |
#include <errno.h> | |
#include <string.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <netinet/in.h> | |
#include <arpa/inet.h> | |
#include <sys/wait.h> |
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/types.h> | |
#include <sys/socket.h> | |
#include <netdb.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <string.h> | |
#define BUF_SIZE 500 |
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 <asm/types.h> | |
#include <sys/socket.h> | |
#include <linux/netlink.h> | |
#include <linux/rtnetlink.h> | |
#include <net/if.h> | |
int 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
import gzip | |
import json | |
import requests | |
try: | |
from cStringIO import StringIO | |
except: | |
from StringIO import StringIO | |
# Let's fetch the Common Crawl FAQ using the CC index | |
resp = requests.get('http://index.commoncrawl.org/CC-MAIN-2015-27-index?url=http%3A%2F%2Fcommoncrawl.org%2Ffaqs%2F&output=json') |
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/sh | |
>/tmp/maxmem.out | |
>/tmp/maxmem2.out | |
for i in /proc/[1-9]* ; do | |
grep -q VmSize $i/status || continue | |
awk '/^VmSize:/{printf("%s ",$2);};' $i/status >> /tmp/maxmem.out | |
awk '/^VmRSS:/{printf("%s ",$2)};' $i/status >> /tmp/maxmem2.out | |
echo -n " $i " >> /tmp/maxmem.out | |
echo -n " $i " >> /tmp/maxmem2.out | |
echo >> /tmp/maxmem.out |
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 <netdb.h> | |
#include <netinet/in.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/socket.h> | |
#include <sys/types.h> | |
#include <errno.h> |
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 <netdb.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/socket.h> | |
#define PORT 8080 |
OlderNewer