Skip to content

Instantly share code, notes, and snippets.

@wynand1004
wynand1004 / snake_game.py
Created September 2, 2018 08:56
A Simple Snake Game made in Python 3
# Simple Snake Game in Python 3 for Beginners
# By @TokyoEdTech
import turtle
import time
import random
delay = 0.1
# Score
@1st1
1st1 / example.py
Last active October 20, 2024 19:56
asyncio queues example
import asyncio
import random
import time
async def worker(name, queue):
while True:
# Get a "work item" out of the queue.
sleep_for = await queue.get()
@Mahedi-61
Mahedi-61 / cuda_11.8_installation_on_Ubuntu_22.04
Last active April 25, 2025 18:27
Instructions for CUDA v11.8 and cuDNN 8.9.7 installation on Ubuntu 22.04 for PyTorch 2.1.2
#!/bin/bash
### steps ####
# Verify the system has a cuda-capable gpu
# Download and install the nvidia cuda toolkit and cudnn
# Setup environmental variables
# Verify the installation
###
### to verify your gpu is cuda enable check
@kittinan
kittinan / client.py
Last active March 26, 2025 08:29
Python OpenCV webcam send image frame over socket
import cv2
import io
import socket
import struct
import time
import pickle
import zlib
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect(('192.168.1.124', 8485))
@martinohanlon
martinohanlon / sensehat_thermalcam.py
Created November 20, 2017 21:54
Python thermal camera example using Sense Hat and AMG8833
"""
An adaptation of Adafruit's thermal camera example which
uses the sense hat to display temperatures.
Martin O'Hanlon
@martinohanlon
stuffaboutco.de
"""
from sense_hat import SenseHat
from Adafruit_AMG88xx import Adafruit_AMG88xx
@Andrew-rw
Andrew-rw / kinect_view-2.rviz
Created October 1, 2017 19:12
rviz view files
Panels:
- Class: rviz/Displays
Help Height: 129
Name: Displays
Property Tree Widget:
Expanded:
- /Global Options1
- /Status1
- /LaserScan1
- /PointCloud21
@jorgesaldivar
jorgesaldivar / ubuntu.terminal
Last active December 4, 2024 09:49
MAC OS Theme that will make the terminal look like Ubuntu
# MAC OS Theme that will make the terminal look like Ubuntu
# This theme has been created from scratch by fetching all the ANSI colors and fonts from Ubuntu.
# With the exception of the following command fetched from
# http://osxdaily.com/2012/02/21/add-color-to-the-terminal-in-mac-os-x/
# command: "export LSCOLORS=ExFxBxDxCxegedabagacad"
# 1) Copy the following under ~/.bash_profile and restart the terminal.
@ritiek
ritiek / folder_predict.py
Last active November 6, 2022 13:23
Keras predicting on all images in a directory
from keras.models import load_model
from keras.preprocessing import image
import numpy as np
import os
# image folder
folder_path = '/path/to/folder/'
# path to model
model_path = '/path/to/saved/model.h5'
# dimensions of images
#!/usr/bin/env python
'''Crop an image to just the portions containing text.
Usage:
./crop_morphology.py path/to/image.jpg
This will place the cropped image in path/to/image.crop.png.
For details on the methodology, see
@Breta01
Breta01 / SavingModelTF.py
Last active January 9, 2020 14:30
Code for creating, training and saving TensorFlow model.
import tensorflow as tf
### Linear Regression ###
# Input placeholders
x = tf.placeholder(tf.float32, name='x')
y = tf.placeholder(tf.float32, name='y')
# Model parameters
W1 = tf.Variable([0.1], tf.float32)
W2 = tf.Variable([0.1], tf.float32)
W3 = tf.Variable([0.1], tf.float32)
b = tf.Variable([0.1], tf.float32)