Skip to content

Instantly share code, notes, and snippets.

View InputBlackBoxOutput's full-sized avatar
🐮

Rutuparn Pawar InputBlackBoxOutput

🐮
View GitHub Profile
@InputBlackBoxOutput
InputBlackBoxOutput / check.py
Created March 12, 2023 17:27
Check TPU version on Google Colab
import os
from tensorflow.python.profiler import profiler_client
tpu_profile_service_address = os.environ['COLAB_TPU_ADDR'].replace('8470', '8466')
print(profiler_client.monitor(tpu_profile_service_address, 100, 2))
@InputBlackBoxOutput
InputBlackBoxOutput / scraper.py
Created February 26, 2023 19:49
Scrape images from a website
import os
import shutil
import requests
import time
import random
# pip install requests-html
from requests_html import HTMLSession
session = HTMLSession()
@InputBlackBoxOutput
InputBlackBoxOutput / NETHER-README.md
Created January 10, 2023 02:35
NETHER: Virtual reality controller for playing Minecraft

NETHER

Virtual reality controller for playing minecraft

Salient features

  • Modular to support addons
  • Tangle free gaming since the entire system is wireless
  • Minimal lag during gaming due to high-speed data transfer
  • Product certifications: CE certified and ROHS compliant

System block diagram

@InputBlackBoxOutput
InputBlackBoxOutput / INGAME-README.md
Created January 10, 2023 02:32
INGAME: Virtual reality controller for playing FPS games

INGAME

INGAME is a motion emulator with virtual reality features for playing first person shooting/adventure games. Virtual reality (VR) is a simulated experience that can be similar to or completely different from the real world. INGAME has been designed to provide the user with the feeling of being 'IN-the-GAME'. INGAME is modular in nature and consists of the following modules.

  1. HID module
  2. Controller module
@InputBlackBoxOutput
InputBlackBoxOutput / clear.cpp
Created December 11, 2022 01:26
A workaroud to use clear as a command to clear Command Prompt
// A workaroud to use clear as a command to clear Command Prompt
// Step 1: g++ clear.cpp -o clear.exe
// Step 2: Add clear.exe directory to PATH enviroment variable
#include<cstdlib>
int main() {
system("cls");
return 0;
}
@InputBlackBoxOutput
InputBlackBoxOutput / serial.py
Created July 3, 2022 15:42
Print serial data sent over USB from a development board
import sys
import serial
import serial.tools.list_ports as port_list
def serial_communication():
ports = list(port_list.comports())
if ports == []:
print("No open ports found!")
sys.exit()
@InputBlackBoxOutput
InputBlackBoxOutput / convert.py
Created June 18, 2022 16:52
Convert bounding boxes from YOLO format into JSON format expected by edge-impulse-uploader
import os, glob, json
import cv2
class BoundingBoxConvertor:
def __init__(self):
self.label_map = {
"0":"class1",
"1":"class2",
"2":"class3"
}
@InputBlackBoxOutput
InputBlackBoxOutput / get_webpage.py
Created March 28, 2022 12:58
Get the HTML source code for a webpage
import requests
headers = {
'User-Agent': "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"
}
def get_webpage():
url = "www.google.com"
print(url)
response = requests.request("GET", url, headers=headers)
@InputBlackBoxOutput
InputBlackBoxOutput / segmentation.py
Created March 28, 2022 03:52
Green color segmentation using HSV value thresholding
import cv2
import numpy as np
import time
greenHSVLowerLimit = (24, 76, 0)
greenHSVUpperLimit = (84, 255, 255)
VideoStream = cv2.VideoCapture(0)
time.sleep(2.0)
@InputBlackBoxOutput
InputBlackBoxOutput / segmentation.py
Created March 28, 2022 03:44
Image segmentation using k-means clustering
import cv2
import numpy as np
import matplotlib.pyplot as plt
image = cv2.imread("sample-images/minions.jpg")
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
plt.imshow(image)
pixel_values = image.reshape((-1, 3))
pixel_values = np.float32(pixel_values)