Skip to content

Instantly share code, notes, and snippets.

View rhlc's full-sized avatar
🎯
Focusing

Rahul rhlc

🎯
Focusing
View GitHub Profile
@rhlc
rhlc / ping-sound.sh
Created July 1, 2019 16:08
bash script to ping with sound whenever internet is down
ISP=1.1.1.1
while :
do
ping -t 2 -o -c 1 $ISP || echo -en "\007"
sleep 1
done
'''
Name: rahul choudhary
Github: https://github.com/r-choudhary
Date: 04 Jan, 2020
'''
# 1
# import math module
import math
def square_root(num):
Box
Box
Icon
Text
Button
Box
Text
Text
Button
Text
@rhlc
rhlc / phone-extract.py
Created March 20, 2020 01:01
Script to extract email and mobile phone num from text in clipboard.
import re, pyperclip
# Create a regex for phone numbers
phoneRegex = re.compile(r'''
# 91-1234567890
(\d\d) # country code
(\s|-) # separator
\d{10} # 10 digits
''', re.VERBOSE)
# https://towardsdatascience.com/controlling-the-web-with-python-6fceb22c5f08
# https://sites.google.com/a/chromium.org/chromedriver/home
from selenium import webdriver
driver = webdriver.Chrome()
driver.get('https://university.attainu.com/')
user = driver.find_element_by_css_selector(".ant-input[type='email']")
user.send_keys('EMAIL HERE')
import { useEffect } from 'react'
import {
CardElement,
Elements,
useStripe,
useElements,
} from '@stripe/react-stripe-js'
import Stripe from 'stripe'
const stripeApi = new Stripe(
access-control-allow-credentials: true
access-control-allow-methods: GET, POST, HEAD, OPTIONS, DELETE
access-control-allow-origin: http://localhost:3000
access-control-expose-headers: Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required
access-control-max-age: 300
cache-control: no-cache, no-store
content-length: 324
content-type: application/json
date: Mon, 24 May 2021 13:30:19 GMT
server: nginx
@rhlc
rhlc / plateEditor.tsx
Created October 30, 2021 22:35
Plate editor component
import ReactDOM from 'react-dom'
import React, { useMemo, useState } from 'react'
import {
createPlateComponents,
createPlateOptions,
HeadingToolbar,
PlatePlugin,
Plate,
ToolbarSearchHighlight,
createAlignPlugin,
{
"data": {
"project": [
{
"created_at": "2022-02-03T14:21:20.531848+00:00",
"tasks": [
{
"created_at": "2022-02-03T14:24:02.903286+00:00",
"status": "APPROVED",
"task_feedbacks": [