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 <string.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <netdb.h> | |
#include <unistd.h> | |
#include <arpa/inet.h> | |
int main(int argc, char **argv) { |
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 <sys/types.h> | |
#include <sys/socket.h> | |
#include <netdb.h> | |
#include <unistd.h> | |
int main(int argc, char **argv) { | |
int s; |
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 <sys/types.h> | |
#include <sys/socket.h> | |
#include <netdb.h> | |
struct addrinfo hints, *infoptr; // So no need to use memset global variables | |
int main() { | |
hints.ai_family = AF_INET; // AF_INET means IPv4 only addresses |
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 cv2 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
image = cv2.imread('images/scan.jpg') | |
cv2.imshow('Original', image) | |
cv2.waitKey(0) | |
# Cordinates of the 4 corners of the original image |
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 cv2 | |
import numpy as np | |
image = cv2.imread('images/input.jpg',0) | |
height, width = image.shape | |
# Extract Sobel Edges | |
sobel_x = cv2.Sobel(image, cv2.CV_64F, 0, 1, ksize=5) | |
sobel_y = cv2.Sobel(image, cv2.CV_64F, 1, 0, ksize=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
import cv2 | |
import numpy as np | |
image = cv2.imread('images/opencv_inv.png', 0) | |
cv2.imshow('Original', image) | |
cv2.waitKey(0) | |
# Let's define our kernel size | |
kernel = np.ones((5,5), np.uint8) |
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 cv2 | |
import numpy as np | |
# Load our image as greyscale | |
image = cv2.imread('images/gradient.jpg',0) | |
cv2.imshow('Original', image) | |
# Values below 127 goes to 0 (black, everything above goes to 255 (white) | |
ret,thresh1 = cv2.threshold(image, 127, 255, cv2.THRESH_BINARY) | |
cv2.imshow('1 Threshold Binary', thresh1) |
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: utf-8 -*- | |
import re | |
with open('input.txt', 'r') as f: | |
data = f.read() | |
normal = "(\d+/\d+/\d+)" | |
normal_month_date = "(\d+/\d+)" | |
normal_year = '[0-9][0-9][0-9][0-9]' |
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 Solution(object): | |
def subsetsWithDup(self, nums): | |
""" | |
:type nums: List[int] | |
:rtype: List[List[int]] | |
""" | |
nums = sorted(nums) | |
result = [] | |
temp = [] | |
self.backtrack(nums, result, temp, 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
class Solution(object): | |
def subsets(self, nums): | |
""" | |
:type nums: List[int] | |
:rtype: List[List[int]] | |
""" | |
nums = sorted(nums) | |
result = [] | |
temp = [] | |
self.backtrack(nums, result, temp, 0) |
NewerOlder