Skip to content

Instantly share code, notes, and snippets.

View HeySreelal's full-sized avatar
🛰️
under the sun, in search of another sun

Sree (Taylor's Version) HeySreelal

🛰️
under the sun, in search of another sun
View GitHub Profile
@HeySreelal
HeySreelal / random_member.py
Created October 19, 2024 17:37
Pick a random member from group/channel in Telegram
from pyrogram.client import Client
import asyncio
import random
api_id = 123456 # Your Telegram API ID
api_hash = "api-hash" # Telegram API Hash
chat_id = -100123456 # Group ID/Username
app = Client("my_account", api_id, api_hash, device_model="Random Member Picker", system_version="dev/randommember")
@HeySreelal
HeySreelal / bot.dart
Created April 15, 2024 17:00
Solution for this StackOverflow Question: https://stackoverflow.com/q/78325403/10006183
import 'dart:io';
import 'package:televerse/televerse.dart';
// Bot instance
final bot = Bot(
Platform.environment["BOT_TOKEN"]!,
);
// - Variables - //
@HeySreelal
HeySreelal / billion.dart
Created March 8, 2024 14:21
Yeah, just run it and see how large a billion actually is!
void main() {
final million = 1e6;
final billion = 1e9;
final mDur = Duration(seconds: million.toInt());
final bDur = Duration(seconds: billion.toInt());
print('1 million seconds is\n${durToString(mDur)}');
print("");
print('1 billion seconds is\n${durToString(bDur)}');
@HeySreelal
HeySreelal / binary_search.py
Created February 20, 2024 06:27
Model lab examination shits :)
def binary_search(arr, target):
left = 0
right = len(arr) - 1
while left <= right:
mid = (left + right) // 2
if arr[mid] == target:
return mid
elif arr[mid] < target:
left = mid + 1
@HeySreelal
HeySreelal / rsa.dart
Last active February 19, 2024 15:29
When your teacher gives you assignment to work out RSA algorithm, you code it to automate it and copy-paste to submit! 🤖 Damn man, I love Dart!
import 'dart:math' as math;
import 'dart:io';
void main() {
stdout.write("❓ Enter p: ");
final p = int.parse(stdin.readLineSync()!);
stdout.write("❓ Enter q: ");
final q = int.parse(stdin.readLineSync()!);
final n = p * q;
@HeySreelal
HeySreelal / thexyprob.dart
Created February 10, 2024 15:19
This is a simple code for a Telegram bot to add Inline Keyboard Markup to all the messages specified.
import 'dart:io';
import 'package:televerse/televerse.dart';
final api = RawAPI(Platform.environment['BOT_TOKEN']!);
void main(List<String> args) async {
const id = ChannelID("@thexyprob");
final keys = langMsg.keys.toList();
final keyboard = buildKeyboard();
for (final el in keys) {
final msgId = int.parse(langMsg[el]!.split("/").last);
@HeySreelal
HeySreelal / schools.dart
Last active December 3, 2022 17:33
Demo Code: Search in JSON - The full code for StackOverflow question #74668608 :)
import 'dart:convert';
/// Core School class. Details about individual School.
class School {
String city;
String districty;
String name;
School({required this.city, required this.name, required this.districty});
factory School.fromJson(Map<String, dynamic> json) {
@HeySreelal
HeySreelal / index.js
Created March 18, 2022 12:48
Actions On Google Fulfilment On Custom Server
const { conversation } = require('@assistant/conversation')
const express = require('express')
const bodyParser = require('body-parser')
const app = conversation()
app.handle('test_handle', conv => {
conv.add('Hey, finally you did it?')
})