Skip to content

Instantly share code, notes, and snippets.

View DipanshKhandelwal's full-sized avatar

Dipansh Khandelwal DipanshKhandelwal

View GitHub Profile
@DipanshKhandelwal
DipanshKhandelwal / m3u8-mp4.sh
Created April 26, 2021 18:28
Simply convert m3u8 streams to mp4
ffmpeg -i "link.m3u8" -bsf:a aac_adtstoasc -c copy file.mp4
@DipanshKhandelwal
DipanshKhandelwal / useAnchorScroll.ts
Created February 4, 2021 13:18
React hook to scroll to anchor tags
import { useEffect } from 'react'
const useAnchorScroll = (dependencies: any[]) => {
useEffect(() => {
if (location.hash) {
const anchorEl = document.getElementById(location.hash.slice(1))
if (anchorEl) {
anchorEl.scrollIntoView({
behavior: 'smooth',
block: 'start'
import React, { useState, useEffect } from 'react';
import { Text, StyleSheet, Button, View } from 'react-native';
import { RTCPeerConnection, RTCView, mediaDevices, RTCIceCandidate, RTCSessionDescription } from 'react-native-webrtc';
import { db } from '../utilities/firebase';
const configuration = {
iceServers: [
{
urls: ['stun:stun1.l.google.com:19302', 'stun:stun2.l.google.com:19302'],
import React, { useState, useEffect } from 'react';
import { Text, StyleSheet, Button, View } from 'react-native';
import { RTCPeerConnection, RTCView, mediaDevices, RTCIceCandidate, RTCSessionDescription } from 'react-native-webrtc';
import { db } from '../utilities/firebase';
const configuration = {
iceServers: [
{
urls: ['stun:stun1.l.google.com:19302', 'stun:stun2.l.google.com:19302'],
import React, { useState } from 'react';
import { Text, StyleSheet, SafeAreaView, RecyclerViewBackedScrollView } from 'react-native';
import RoomScreen from './screens/RoomScreen';
import CallScreen from './screens/CallScreen';
import JoinScreen from './screens/JoinScreen';
// Just to handle navigation
export default function App() {
const screens = {
ROOM: 'JOIN_ROOM',
import React, { useState } from 'react';
import { Text, StyleSheet, Button, View, TextInput } from 'react-native';
export default function RoomScreen({ setScreen, screens, setRoomId, roomId }) {
const onCallOrJoin = (screen) => {
if (roomId.length > 0) {
setScreen(screen)
}
}
@DipanshKhandelwal
DipanshKhandelwal / twitter_verified_usernames_selenium.py
Created August 19, 2020 16:03
Scraping Verified Twitter Usernames using Selenium
import time
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--headless")
driver = webdriver.Chrome('/usr/lib/chromium-browser/chromedriver', chrome_options=chrome_options)
driver.get('https://www.twitter.com/login')
@DipanshKhandelwal
DipanshKhandelwal / twitter_verified_usernames.py
Created August 19, 2020 10:50
Scraping Verified Twitter Usernames
import oauth2 as oauth
import json
import random
import time
# You can add as many keys as you want here !! :)
keys = {
"key1": {
"CONSUMER_KEY": "",
"CONSUMER_SECRET": "",
@DipanshKhandelwal
DipanshKhandelwal / index.html
Created March 12, 2020 06:46
Simple HTML5 Socket
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=utf-8>
<title>HTML5 Socket</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.0/socket.io.js"></script>
<script>
const socket = io.connect('ws://localhost:8080', { transports: ['websocket'] });
console.log(socket);
socket.on('connect', () => {