Skip to content

Instantly share code, notes, and snippets.

@lokesh1729
lokesh1729 / search_repos.py
Created September 14, 2020 09:06
Search Github Repos
import requests
import sys
import webbrowser
GITHUB_URL = "https://api.github.com/search/repositories?q={query_string}&sort=stars"
class CustomException(Exception):
pass
@lokesh1729
lokesh1729 / Nginx Redirection Flow
Last active January 6, 2021 11:50
Nginx configuration with certbot
Nginx Redirection flow
www.host.com www.host.com
80 443
\ /
@lokesh1729
lokesh1729 / get_twitter_following_list.py
Created July 29, 2021 07:03
Get twitter following list
import tweepy
import os
consumer_key = os.getenv("TWITTER_API_KEY")
consumer_secret = os.getenv("TWITTER_API_SECRET")
access_token = os.getenv("TWITTER_OAUTH_TOKEN")
access_token_secret = os.getenv("TWITTER_OAUTH_SECRET")
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
import tweepy
import os
consumer_key = os.getenv("TWITTER_API_KEY")
consumer_secret = os.getenv("TWITTER_API_SECRET")
access_token = os.getenv("TWITTER_OAUTH_TOKEN")
access_token_secret = os.getenv("TWITTER_OAUTH_SECRET")
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
@lokesh1729
lokesh1729 / consumer.py
Last active December 27, 2022 09:10
Code for my blog
from kafka import KafkaConsumer
consumer1 = KafkaConsumer('payments', group_id="group1", bootstrap_servers='localhost:9092')
for msg in consumer1:
print(msg)
@lokesh1729
lokesh1729 / notion_rename_exported_files.py
Last active January 8, 2024 12:20
When you export your notion notes, they will be exported with a 32 random character suffix. This script removes them.
import os
import re
import logging
def rename_it(dirpath, path_suffix, is_dir):
pattern = r"([a-zA-Z0-9\s\+\&\']+)\s([a-z0-9]{32})"
match = re.match(pattern, path_suffix)
if match is not None:
if is_dir:
import csv
import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--file")
parser.add_argument("--outfile")
args = parser.parse_args()
mapping = {