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<string.h> | |
char *PATH="PATH=/bin:/usr/bin"; //System PATH variable. | |
void process(char *msg); //function to execute a command without a pipe | |
void processWithPipe(char *msg); //function to execute commands with a pipe |
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
def makeAlphaFreqDist(words): | |
adist = FreqDist() | |
pattern = re.compile('.*[^a-z].*') | |
for word in words: | |
if not pattern.match(word): | |
adist[word] += 1 | |
return adist |
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
def bigramDist(words,stoplist): | |
biDist = FreqDist() | |
uniDist = alphaStopFreqDist(words,stoplist) | |
for i in range(1, len(words)): | |
if words[i-1] in uniDist and words[i] in uniDist: | |
biWord = words[i-1] + ' ' + words[i] | |
biDist[biWord] += 1 | |
return biDist |
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
def stem(word): | |
for suffix in ['ing','ly','ed','ious','ies','ive','es','s']: | |
if word.endswith(suffix): | |
return word[:-len(suffix)] | |
return word |
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
public static void quickSort(int array[]) { | |
quickSort(array, 0, array.length - 1); | |
} | |
public static void quickSort(int array[], int start, int end) { | |
int i = start; | |
int k = end; | |
if (end - start >= 1) { | |
int pivot = array[start]; |
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 "contiki.h" | |
#include "dev/leds.h" | |
PROCESS(blink_process, "Blink"); | |
AUTOSTART_PROCESSES(&blink_process); | |
PROCESS_THREAD(blink_process,ev,data) | |
{ | |
PROCESS_EXITHANDLER(goto exit;) | |
PROCESS_BEGIN(); |
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
CONTIKI_PROJECT=P3 | |
all:$(CONTIKI_PROJECT) | |
CONTIKI=../.. | |
include $(CONTIKI)/Makefile.include |
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 "contiki.h" | |
#include "dev/button-sensor.h" | |
#include <stdio.h> | |
PROCESS(blink_process, "Blink"); | |
AUTOSTART_PROCESSES(&blink_process); | |
PROCESS_THREAD(blink_process,ev,data){ | |
PROCESS_BEGIN(); | |
SENSORS_ACTIVATE(button_sensor); |
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 "contiki.h" | |
#include "dev/button-sensor.h" | |
#include "dev/leds.h" | |
#include <stdio.h> | |
PROCESS(blink_process, "Blink"); | |
AUTOSTART_PROCESSES(&blink_process); | |
PROCESS_THREAD(blink_process,ev,data){ | |
PROCESS_BEGIN(); |
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
class Stack: | |
def __init__(self): | |
self.items=[] | |
def isEmpty(self): | |
return self.items==[] | |
def push(self,item): | |
self.items.append(item) |
OlderNewer