Skip to content

Instantly share code, notes, and snippets.

View rudrathegreat's full-sized avatar
🎥
Running a YouTube Channel!

Rudra Sekhri rudrathegreat

🎥
Running a YouTube Channel!
View GitHub Profile
@rudrathegreat
rudrathegreat / Snipplr-25250.py
Last active December 28, 2018 09:19 — forked from lambdamusic/Snipplr-25250.py
Error Handling in Python - Python 3
## Error handling in Python is done through the use of exceptions that are caught in try blocks and handled in except blocks. If an error is encountered, a TRy block code execution is stopped and transferred down to the except block, as shown in the following syntax:
data = 'Hello and welcome to Earth (if you are an alien)'
try:
f = open("test.txt")
except IOError:
print("Cannot open file.")
## In addition to using an except block after the try block, you can also use the finally block. The code in the finally block will be executed regardless of whether an exception occurs.
@rudrathegreat
rudrathegreat / BBC_Microbit_Rover.py
Created December 4, 2018 02:14
Control a BBC Microbit Rover
from microbit import *
import radio
radio.config(channel = 5)
radio.on()
while True:
display.show("f")
if button_a.is_pressed():
radio.send("left")
@rudrathegreat
rudrathegreat / QR_Code_read.py
Created November 28, 2018 07:56
QR Code Reader For the Raspberry Pi
import os
import subprocess
from PIL import Image
import zbarlight
import pygame, sys
from pygame.locals import *
global DISPLAYSURF, FPSCLOCK
pygame.init()
DISPLAYSURF = pygame.display.set_mode((400, 300))
pygame.display.set_caption("QR code reader")
@rudrathegreat
rudrathegreat / File_Management.py
Last active November 27, 2018 08:00
Package For Piece Check
'''
This file is the package required in the Piece Check
Text Editing Application. You can check out the Repo
here, link below -
https://github.com/rudrathegreat/Piece-Check--Text-Editing-App
If you would like to experiment with the Piece Check code,
then just simply go here, link below, to the gist which
contains the code -
@rudrathegreat
rudrathegreat / PieceCheck.py
Last active November 27, 2018 08:00
A Text Editing Application
'''
Welcome to Piece Check, a text editing application for
the people who do not really know or remember the grammar
rules in English.
This application requires GingerIt and Python 3.6. You can
simply download GingerIt from the command line using the
following line -
pip install gingerit
@rudrathegreat
rudrathegreat / Receiving.py
Last active November 25, 2018 01:28
A Program to Receive Stuff on the BBC Microbit
'''
Only works on BBC Microbits.
The code was originally from
the repository Microbit Projects,
link below -
https://github.com/rudrathegreat/Microbit-Projects
'''
@rudrathegreat
rudrathegreat / Game.bat
Created November 25, 2018 01:23
A Quick Game For Fun
#!/bin/bash
# Only works on Machines with Bash scipts, not Batch Scripts
pwd
echo ''
for i in $(ls)
do
echo $i
@rudrathegreat
rudrathegreat / Serial.py
Created November 25, 2018 00:55
Raspberry Pi Serial Communication
'''
This program is designed to be used on the Raspberry
Pi only or any other device which accepts Python and
can do serial communication.
You will not find the module serial in your Python
which has been downloaded. You need to download it
seperately.
This code originally came from the repository Zumo
@rudrathegreat
rudrathegreat / Menubar.css
Created November 25, 2018 00:47
Css Styling For Menubar.Html
@keyframes slider {
0% {
left:0;
}
20% {
left:0;
}
25% {
left:-100%;
}