Skip to content

Instantly share code, notes, and snippets.

# https://stackoverflow.com/questions/54916400/speech-to-text-in-python-with-a-wav-file
import speech_recognition as sr
r = sr.Recognizer()
hellow=sr.AudioFile('hello_world.wav')
with hellow as source:
audio = r.record(source)
try:
s = r.recognize_google(audio)
<form method="POST" name="form1" onsubmit="IsYoutube()">
<input type="text" placeholder="Enter Youtube URL" name="URL">
<button type="submit" name="btn1">Enter</button>
</form>
<script>
function IsYoutube() {
var urls = document.forms['form1']['URL'].value.toLowerCase() ;
if (!urls.includes('youtu')) {
alert('!Must be Youtube link :)');
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
#create Data
X = np.array([-10,-7,-4,-1,2,5,8,11,14,17])
y = np.array([0,3,6,9,12,15,18,21,24,27])
X = tf.cast(tf.constant(X),dtype=tf.float32)
y = tf.cast(tf.constant(y),dtype=tf.float32)
<h1>I'm <span class="auto-type"></span></h1>
<script src="https://cdn.jsdelivr.net/npm/typed.js@2.0.12"></script>
var typed = new Typed('.auto-type',{
strings: ['NickyGenN','a Python Learner'],
typeSpeed:220,
backSpeed:150,
loop:false
}
<div class="list-menu" id="menuList">
...</div>
<img class="toggle" src="toggle.png" id="toggle" onclick="togglemenu()">
var menuList = document.getElementById('menuList');
menuList.style.display = 'none';
function togglemenu(){
if (menuList.style.display == 'none'){
menuList.style.display = 'block'
}
import numpy as np
import cv2
size = .5
img = cv2.resize(cv2.imread('https://res09.bignox.com/appcenter/th/2020/06/dde3bac928a9cea8ad9c441c6e28f38c.jpg',0), (0,0), fx=size,fy=size ) # gray scale
ball = cv2.resize(cv2.imread('allain.jpg',0), (0,0), fx=size,fy=size ) # gray scale
h, w = ball.shape
methods = [cv2.TM_CCOEFF, cv2.TM_CCOEFF_NORMED, cv2.TM_CCORR,cv2.TM_CCORR_NORMED,cv2.TM_SQDIFF,cv2.TM_SQDIFF_NORMED]
def Knn(data):
X = np.array([[40,150],
[50,130],
[50,170],
[60,160],
[70,140],
[70,180],
[75,185],
[120,185],
[40,130],
cap = cv2.VideoCapture(0)
while True :
_,frame = cap.read()
width = int(cap.get(3))
height = int(cap.get(4))
hsv = cv2.cvtColor(frame,cv2.COLOR_BGR2HSV)
light_blue = np.array([90,50,50])
dark_blue = np.array([130,255,255]) #Blue
def Monti(n=1000):
l = 4
rocks = np.random.uniform(0,l,(n,2))
rocks_in_circle = []
h = l//2
k = l//2
r = l//2
for id,rock in enumerate(rocks):
if (rock[0]-h)**2 + (rock[1]-k)**2 <= r**2 :
import matplotlib.pyplot as plt
image = plt.imread('https://www.sweetiescandy.com/wp-content/uploads/2019/06/m-and-ms.jpg')
R = image[:,:,0]
G = image[:,:,1]
B = image[:,:,2]
plt.subplot(2,2,1);plt.imshow(image)
plt.subplot(2,2,2);plt.imshow(R,cmap='gray')
plt.subplot(2,2,3);plt.imshow(G,cmap='gray')