This file contains hidden or 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 #pip install opencv-python | |
key = cv2. waitKey(1) | |
webcam = cv2.VideoCapture(0) | |
while True: | |
try: | |
check, frame = webcam.read() | |
cv2.imshow("Capturing", frame) | |
key = cv2.waitKey(1) | |
if key == ord('s'): | |
cv2.imwrite(filename='saved_img.jpg', img=frame) |
This file contains hidden or 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 java.io.*; | |
import java.net.ServerSocket; | |
import java.net.Socket; | |
import java.util.Scanner; | |
public class JavaServer { | |
public static void main(String[] args) { | |
connectToServer(); | |
} |
This file contains hidden or 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
<?php | |
require('phpmailer/PHPMailerAutoload.php'); | |
//Taking data from a form | |
$name = trim($_POST['con_name']); | |
$email = trim($_POST['con_email']); | |
$subject = trim($_POST['con_subject']); | |
$message = trim($_POST['con_comment']); | |
if($name != null && $email != null && $subject != null && $message != null){ | |
if(!filter_var($email, FILTER_VALIDATE_EMAIL)) |
This file contains hidden or 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
<?php | |
require('phpmailer/PHPMailerAutoload.php'); | |
//Getting data from a form | |
$name = trim($_POST['con_name']); | |
$email = trim($_POST['con_email']); | |
$subject = trim($_POST['con_subject']); | |
$message = trim($_POST['con_comment']); | |
if($name != null && $email != null && $subject != null && $message != null){ | |
if(!filter_var($email, FILTER_VALIDATE_EMAIL)) | |
{ |
This file contains hidden or 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
<?php | |
/** | |
* PHPMailer SPL autoloader. | |
* PHP Version 5 | |
* @package PHPMailer | |
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project | |
* @author Marcus Bointon (Synchro/coolbru) <[email protected]> | |
* @author Jim Jagielski (jimjag) <[email protected]> | |
* @author Andy Prevost (codeworxtech) <[email protected]> | |
* @author Brent R. Matzelle (original founder) |
This file contains hidden or 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
<?php | |
$whitelist = array('127.0.0.1','::1'); | |
if(!in_array($_SERVER['REMOTE_ADDR'], $whitelist)){ | |
//SERVER | |
$server = 'localhost'; | |
$username = 'server_username'; | |
$password = 'server_password'; | |
$dbname = 'username_dbname'; | |
$conn = mysqli_connect($server, $username, $password, $dbname); |
This file contains hidden or 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
from datetime import datetime | |
from random import randint | |
uid = str(datetime.utcnow().strftime('%Y%m%d%H%M%S%f')[:-3]*randint(1,37)) | |
print(f"Here: {uid}\nUse this logically unique ID if you aren't using the traditional +=1 technique!") |
This file contains hidden or 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
/* | |
Get the MAC address of a local system. | |
This can be used to ID systems on your network. | |
MAC addresses can be spoofed but are not in most cases | |
and are static unless tampered with so it makes a better ID than a client's IP address. | |
*/ | |
const getmac = require('getmac'); //https://www.npmjs.com/package/getmac | |
const callMac = () =>{ |
This file contains hidden or 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 #pip install opencv-python | |
#This program generates a cartoonized image of the given image! | |
img = cv2.imread("image.jpg") | |
def color_quantization(img, k): | |
data = np.float32(img).reshape((-1, 3)) | |
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 20, 1.0) | |
ret, label, center = cv2.kmeans(data, k, None, criteria, 10, cv2.KMEANS_RANDOM_CENTERS) | |
center = np.uint8(center) | |
result = center[label.flatten()] |
This file contains hidden or 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
from PIL import Image | |
from argparse import ArgumentParser | |
from random import shuffle | |
from typing import List, Tuple | |
def generate_pixels(width: int, height: int) -> List[Tuple[int, int]]: | |
"""Generates random pixel locations""" | |
pixels = [] | |
for x in range(width): | |
for y in range(height): |