Skip to content

Instantly share code, notes, and snippets.

View trishantpahwa's full-sized avatar
💭
Busy chilling inside a computer! :P

Trishant Pahwa trishantpahwa

💭
Busy chilling inside a computer! :P
View GitHub Profile
@trishantpahwa
trishantpahwa / my_public_ip.py
Last active May 13, 2023 14:05
Prints Public IP.
import requests
response = requests.get('https://api.ipify.org?format=json')
print(response.text)
# This is an alternative to ngrok. Provided you have a server that is exposed to internet traffic. Gives you a personal domain to reach your program.
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('0.0.0.0', 8080))
s.listen(5)
while True:
@trishantpahwa
trishantpahwa / password_oscillations.js
Last active November 4, 2019 11:27
Password Oscillations
const readline = require('readline');
var passwordsLog = { };
function addLoginField(loginField, password) {
passwordsLog[loginField] = { };
var date = new Date();
date.toLocaleDateString("en-IN");
passwordsLog[loginField].password = date;
@trishantpahwa
trishantpahwa / download_projects.py
Last active July 5, 2019 11:19
Download all of your GitHub projects.
# This script allows you to download all of your GitHub projects.
import requests
import os
username = raw_input('Enter username: ')
projects = requests.get('http://api.github.com/users/' + username + '/repos')
projects = projects.json()
for project in projects:
@trishantpahwa
trishantpahwa / remove_pyc_files.py
Created April 7, 2019 17:10
A script to remove pyc files from a project.
import os
import traceback
def traverse_directory(directories):
try:
for directory in directories:
if os.path.isdir(directory):
new_directories = os.listdir(directory)
for new_directory in new_directories: