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 <signal.h> | |
void handler(int signal_number){ | |
printf("Interrupt occured, Ctrl + C is pressed\n"); | |
} | |
int main(){ | |
signal(SIGINT, handler); | |
while(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 <stdlib.h> | |
#include <stdio.h> | |
int main(int argc, char* args[]) { | |
printf("Child process: getpid result: %d with arguments %s and %s\n", getpid(), args[1], args[2]); | |
sleep(5); | |
exit(52); | |
} |
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/wait.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
int main(int argc, char**argv) { | |
printf("Parent process: before fork getpid result: %d\n", getpid()); | |
sleep(5); |
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
{ | |
'language':'en', | |
'orientation':'Up', | |
'textAngle':0.0, | |
'regions':[ | |
{ | |
'boundingBox':'689,768,2462,1049', | |
'lines':[ | |
{ | |
'boundingBox':'689,768,2462,180', |
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 requests | |
response = requests.post(ocr_url, headers=headers, params=params, json=data) | |
response.raise_for_status() | |
analysis = response.json() | |
print analysis |
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
#Defining parameters and orientation | |
params = {'language': 'unk', 'detectOrientation ': 'true'} | |
#Defining image url | |
img = "https://quotefancy.com/download/18846/original/wallpaper.jpg" | |
data = {'url': img} |
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
#Defining base url for API call. | |
base_url = "https://westcentralus.api.cognitive.microsoft.com/vision/v1.0/" | |
ocr_url = base_url + "ocr" | |
#Defining subscription key and headers for subscription key. | |
sub = "98f714r6vb2e193018b28fg1u9b3b0d7e7" | |
headers = {'Ocp-Apim-Subscription-Key': sub} |