Skip to content

Instantly share code, notes, and snippets.

View TERNION-1121's full-sized avatar
🎯
Focusing

Vikrant Singh Bhadouriya TERNION-1121

🎯
Focusing
  • Uttarakhand, India
  • 00:14 (UTC +05:30)
View GitHub Profile
@TERNION-1121
TERNION-1121 / unit-circle.py
Created May 17, 2024 14:31
A script that simulates the trigonometric functions on the unit circle
import math
import pygame
from pygame import Vector2
import pygame_widgets
from pygame_widgets.slider import Slider
from pygame_widgets.textbox import TextBox
pygame.init()
@TERNION-1121
TERNION-1121 / main.py
Created March 7, 2024 19:43
YT-Comments-Extractor
from API_KEY import API_KEY
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
from json import dump
def get_video_comments(videoID: str, max_results: int = 20):
assert isinstance(videoID, str), f"videoID should be a string, received {videoID.__class__.__name__}"
assert isinstance(max_results, int) and 1 <= max_results <= 100, \
@TERNION-1121
TERNION-1121 / RPS-Warefare.py
Last active March 1, 2024 17:09
A Python script to simulate Rocks, Papers and Scissors using pygame.
from random import random
import pygame
from pygame import Vector2
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
enum INFRARED_SENSORS{IR_1 = 2, IR_2 = 3};
enum MOTORS{M1_enA = 5, M1_in1 = 9, M1_in2 = 10, M2_enB = 6, M2_in3 = 11, M2_in4 = 12};
// -------------------------------- defining pins -----------------------------------
extern int M1[3] = {M1_enA, M1_in1, M1_in2};
extern int M2[3] = {M2_enB, M2_in3, M2_in4};
// DC motor pins (motor driver pins)
int IR1_reading, IR2_reading;
int LEFT, RIGHT;
@TERNION-1121
TERNION-1121 / algo.py
Last active July 13, 2022 13:28
Algorithm that would take one string and one list ( of single characters ) from the user and would display the all occurrences of all the characters(given in the list) in the string.
def get_indices(s, lst):
indice = list()
indices = list()
toReturn = ''
for char in lst:
for i in range(len(s)):
if s[i] == char:
indice.append(i)
indices.append(indice)
indice = []