Skip to content

Instantly share code, notes, and snippets.

View aahnik's full-sized avatar
🏠
something's happening!

Aahnik Daw aahnik

🏠
something's happening!
View GitHub Profile
@aahnik
aahnik / #clean-pip.md
Last active May 24, 2025 10:14
A script to uninstall all python packages via pip and clear cache. (For Unix based systems only. Ditch Windows today.)

Run this script directly

curl -Lks bit.ly/pipclear | python
@aahnik
aahnik / bot.py
Last active April 29, 2025 09:23
A simple button creator bot using python-telegram-bot #telegram #python
# pip install python-dotenv python-telegram-bot
# create a .env file with
# BOT_TOKEN=...
# in the same dir as of this script
import logging
from dotenv import load_dotenv
from telegram.ext.filters import Filters
from telegram import ParseMode
import os
@aahnik
aahnik / #get_session_string.md
Last active November 9, 2024 19:29
A python script to get Telegram session string after logging into user account. Using Telethon.

You must ensure that you have Telethon installed. Run pip install telethon to install.

[optional]

You can can create file called .env in the directory from which you are running the script.

.env

@aahnik
aahnik / index.js
Last active March 4, 2024 14:12
[Ejs + Static Files] Frotend Server process... Server all ejs templates from a directory "views" + server static files from "public"
/*
frontend server
server HTML,CSS and frontend js
use ejs to render html
Credits: https://gist.github.com/noampc/6a36885dbe75f24056ac7a3c7f50d2b7
*/
import express from "express";
@aahnik
aahnik / cpp.json
Created January 9, 2024 12:33
Cp Vs code setup for leetcode and codeforces
{
"Cp cpp": {
"prefix": "cpp",
"body": [
"#include <bits/stdc++.h>",
"using namespace std;",
"",
"#ifdef aahnik",
"#include \"dbg.cpp\"",
"#else",
@aahnik
aahnik / oplo.c
Created September 12, 2023 06:44
Testing Optimistic Locking
#include <pthread.h>
#include <stdatomic.h>
#include <stdbool.h>
#include <stdio.h>
#define MAX 90000
atomic_int count = ATOMIC_VAR_INIT(0);
int faltu = 0;
@aahnik
aahnik / #tg_conv_bot.md
Last active August 6, 2023 18:31
A simple conversation bot that will ask user's name, and save it. Persistent, Polling, Shows Button, Has conversation flow, Conversation Handler, python-telegram-bot, ptb,

How to run

  1. Install dependancies.
pip3 install python-dotenv python-telegram-bot
  1. Then put the files of this gist inside a folder.
@aahnik
aahnik / graphs_dot.md
Last active July 31, 2023 16:38
Visualizing graphs and trees while solving dsa problems

Simple guide to visualize graphs

Install the graphviz tool

code_graphviz_install

Run dot -V to check the version and if it was installed properly or not.

@aahnik
aahnik / cat.c
Last active July 27, 2023 20:12
Implementation of cat from book The C Programming Language 2e
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
FILE *fp;
void filecopy(FILE *, FILE *);
if (argc == 1) {
// no input, so copy stdin
filecopy(stdin, stdout);
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.