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
# Using python 2.7? | |
# Open your terminal and run: pip install requests | |
# Using python 3? | |
# Open your terminal and run: pip3 install requests | |
# More information about the requests library can be found here: https://github.com/kennethreitz/requests | |
# Imports are required for both calls | |
import json | |
import requests |
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
# Uses Bluez for Linux | |
# | |
# sudo apt-get install bluez python-bluez | |
# | |
# Taken from: https://people.csail.mit.edu/albert/bluez-intro/x232.html | |
# Taken from: https://people.csail.mit.edu/albert/bluez-intro/c212.html | |
import bluetooth | |
def receiveMessages(): |
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
# I tried to use the pip install wifi but it really didn't work. | |
# So created this | |
import subprocess | |
process = subprocess.Popen(['/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport','-I'], stdout=subprocess.PIPE) | |
out, err = process.communicate() | |
process.wait() | |
print(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
# For more info: http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_gui/py_video_display/py_video_display.html | |
import cv2 | |
import numpy as np | |
# Playing video from file: | |
# cap = cv2.VideoCapture('vtest.avi') | |
# Capturing video from webcam: | |
cap = cv2.VideoCapture(0) | |
currentFrame = 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
# For more info: http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_gui/py_video_display/py_video_display.html | |
import cv2 | |
import numpy as np | |
import os | |
FILE_OUTPUT = 'output.avi' | |
# Checks and deletes the output file | |
# You cant have a existing file or it will through an error | |
if os.path.isfile(FILE_OUTPUT): |
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 json | |
def writeToJSONFile(path, fileName, data): | |
filePathNameWExt = './' + path + '/' + fileName + '.json' | |
with open(filePathNameWExt, 'w') as fp: | |
json.dump(data, fp) | |
# Example | |
data = {} |
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 os | |
def createFolder(directory): | |
try: | |
if not os.path.exists(directory): | |
os.makedirs(directory) | |
except OSError: | |
print ('Error: Creating directory. ' + directory) | |
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 json | |
def getJSON(filePathAndName): | |
with open(filePathAndName, 'r') as fp: | |
return json.load(fp) | |
# Example of returning just JSON | |
# jsonFile = getJSON('./test.json') # Uncomment this line | |
# It gets returned as a dictionary. |
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 os | |
def doesFileExists(filePathAndName): | |
return os.path.exists(filePathAndName) | |
# Example | |
if doesFileExists('./test.json'): | |
print ('Yaa it exists!') | |
else: | |
print ('Nope! Not around') |
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
using UnityEngine; | |
using System.Collections; | |
// I attached this script to my main camera | |
public class GenerateMap : MonoBehaviour { | |
void Start () { | |
int x = 0; | |
int y = 0; | |
// Adding a Prefab/GameObject to Scene using C#. Make sure you create a prefab with the file name |
OlderNewer