Skip to content

Instantly share code, notes, and snippets.

View raghavTinker's full-sized avatar
:octocat:
Building

Raghav Sharma raghavTinker

:octocat:
Building
View GitHub Profile
@raghavTinker
raghavTinker / checkLinks.py
Created August 18, 2021 12:43
Made this for a CTF. had to traverse through 70k links to find a valid one
@raghavTinker
raghavTinker / networkFix.py
Created July 23, 2021 07:38
A TP-Link router was malfunctioning. Required force restarts when the router became unresponsive. A band-aid solution involving a raspberry pi and relay board.
import urllib.error
import ssl
from urllib.parse import urljoin
from urllib.parse import urlparse
from urllib.request import urlopen
import RPi.GPIO as GPIO
import time
import sqlite3
import datetime
@raghavTinker
raghavTinker / tokenGenerator.py
Last active July 22, 2021 04:07
Generate oauth token.json for gdrive access using the credentials.json file
#!/usr/bin/env python
from __future__ import print_function
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
SCOPES = ['https://www.googleapis.com/auth/drive','https://www.googleapis.com/auth/drive.file']
@raghavTinker
raghavTinker / renamePdfFilesData.py
Created July 21, 2021 21:35
Renaming multiple pdf files by extracting the date from the file name and re arranging it in year month day format and putting it in the front of the file name
# Finding the date in a list of files
import os
import glob
import re
files = []
months_in_numbers_small = {'jan':1,'feb':2,'mar':3,'apr':4,'may':5,'jun':6,'jul':7,'aug':8,'sep':9,'oct':10,'nov':11,'dec':12}
for file in glob.glob("*.pdf"):
files.append(file)
@raghavTinker
raghavTinker / sendEmail.py
Created July 21, 2021 21:31
Sending Emails from one account to another
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
my_address = "<SENDER_EMAIL>"
s = smtplib.SMTP(host="<SMPTP_HOST_OF_SENDER_EMAIL", port=587) # the mail server port is usually 587 change according to need
s.starttls()
s.login(my_address, "hariom123@Note")
@raghavTinker
raghavTinker / pdfMerger.py
Created June 30, 2021 05:13
Merging a batch of pdfs
import os
import glob
from PyPDF2 import PdfFileMerger
pdfs = []
for file in glob.glob("*.pdf"):
pdfs.append(file)
pdfs.sort()
merger = PdfFileMerger()
@raghavTinker
raghavTinker / pptToPdfConverter.py
Last active June 30, 2021 05:28
PPT to PDF converter
import os
import glob
files = []
for file in glob.glob("*.ppt*"): #ppt* so that we can include pptx files as well
files.append(file)
files.sort()
for file in files:
print(f"Converting {file} to pdf....")