Skip to content

Instantly share code, notes, and snippets.

View sonigeez's full-sized avatar
🎧
we rollin

bharat sonigeez

🎧
we rollin
View GitHub Profile
// // Fast auto-scroll script that stops when reaching the bottom of the page
// (function() {
// // Configuration - INCREASED SPEED
// const scrollSpeed = 10; // pixels per interval (increased from 1)
// const scrollInterval = 10; // milliseconds between scrolls (decreased from 20)
// // Variables
// let isScrolling = false;
// let scrollIntervalId = null;
export type Tweet = {
id: string;
text: string;
media_urls?: string[];
likes: number;
user: User;
replies?: Tweet[];
};
export type User = {
@sonigeez
sonigeez / x_post_scrapper.js
Created November 25, 2024 12:19
client side code to scrape twitter/x post
function getAllTweets() {
const TWITTER_SEARCH_URL =
"https://x.com/that_anokha_boy";
const SCROLL_INTERVAL = 1000;
const SCROLL_STEP = 5000;
const MAX_UNCHANGED_COUNT = 10;
if (!location.href.startsWith(TWITTER_SEARCH_URL)) {
console.log("Not on the correct Twitter search page. Exiting.");
return;
@sonigeez
sonigeez / copy_all_files.js
Last active November 23, 2024 11:52
js code to copy all files into a single txt file
import { readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
import ignore from "ignore";
import { join } from "node:path";
const ig = ignore();
try {
ig.add(readFileSync(".gitignore", "utf8"));
} catch (err) {
console.log("No .gitignore file found, proceeding without ignore rules");
}
@sonigeez
sonigeez / cloudflare-worker-youtube-dl.js
Created July 13, 2024 21:37 — forked from hizkifw/cloudflare-worker-youtube-dl.js
Download YouTube videos with Cloudflare Worker
/**
* cloudflare-worker-youtube-dl.js
* Get direct links to YouTube videos using Cloudflare Workers.
*
* Usage:
* GET /?v=dQw4w9WgXcQ
* -> Returns a JSON list of supported formats
*
* GET /?v=dQw4w9WgXcQ&f=251
* -> Returns a stream of the specified format ID
const { google } = require('googleapis');
const keys = require('./keys.json');
const scopes = ["https://www.googleapis.com/auth/spreadsheets"];
const SHEET_ID = '1hh1PUVUL_mKLrbawt72X1jh9jOA9REUIwDpf0PmO0yo';
const SHEET_NAME = 'Sheet1';
const client = new google.auth.JWT(
keys.client_email,
@sonigeez
sonigeez / flutter_hot_reload.sh
Created November 11, 2023 08:56
Flutter script to hot reload when file change via terminal for MAC
#!/bin/bash
FLUTTER_LIB_DIR="./lib"
FLUTTER_PID=$(pgrep -fl "flutter.*run" | awk '{print $1}')
echo "Stored Flutter PID: $FLUTTER_PID"
if [ -z "$FLUTTER_PID" ]; then
echo "Flutter process not found. Ensure 'flutter run' is executing."
exit 1
@sonigeez
sonigeez / code_stats.sh
Last active November 23, 2023 20:14
a bash script to get codebase stats.
function git_history {
git log $filename | grep "Date: "
}
function first_commit {
git_history | tail -1
}
function last_commit {
git_history | head -1
@sonigeez
sonigeez / audio_player_service.dart
Created September 26, 2023 08:01
audio player service for soloud package flutter
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter_soloud/flutter_soloud.dart';
class NewAudioPlayerService extends ChangeNotifier {
static NewAudioPlayerService? _instance;
final SoLoud soloud = SoLoud();
SoundProps? currentSound;
StreamController<StreamSoundEvent> soundEvents = StreamController.broadcast();
@sonigeez
sonigeez / squircle_custom_paint.dart
Last active September 23, 2023 09:45
squircle custom paint
import 'package:flutter/material.dart';
import 'dart:math';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const SolarEmulatorApp({super.key});
@override