Skip to content

Instantly share code, notes, and snippets.

View karmanyaahm's full-sized avatar
💭
hello everyone

Karmanyaah Malhotra karmanyaahm

💭
hello everyone
View GitHub Profile
@karmanyaahm
karmanyaahm / py.py
Created October 3, 2020 23:34
Google OpenID API Python get User Info
##it took me hours to find what I wanted in between deprecated APIs and lacking documentation as of Oct 2020, hopefully this'll help someone
import requests
creds = google.oauth2.credentials.Credentials ###not real thing, replace with the credentials you got from the flow
url = 'https://openidconnect.googleapis.com/v1/userinfo'
head = { 'Authorization': 'Bearer '+creds.token}
response = requests.get(url, headers=head)
print(response.json()['sub'])
@karmanyaahm
karmanyaahm / openpgp.md
Created August 28, 2020 04:27
Keyoxide identity proof
@karmanyaahm
karmanyaahm / tootsie_pop.py
Last active July 31, 2020 19:43
Hacktivitycon CTF Tootsie Pop
#it stops once because of python recursion limits but can be manually restarted
#it extracts files and then moves them to one directory so the filename doesn't get too long(which is not supported in some tools like bzip)
from xtract import xtract
import os
import glob
# def names():
def delempty(dirr):
for i in [f[0] for f in os.walk(dirr) if os.path.isdir(f[0])]:
@karmanyaahm
karmanyaahm / audio-source.sh
Created July 28, 2020 17:51
Switch between HDMI and laptop audio in pulse audio with one command
#!/bin/bash
#input hdmi,analog, or check
#you will probably have to change the specific values with information from `pacmd list-cards` before it works for your setup
#I am using this script with https://store.kde.org/p/1297839
CARDID="9d71"
INP=$1
@karmanyaahm
karmanyaahm / bunch_of_random_functions.py
Created July 21, 2020 16:45
Python 3.8 file handling functions
import os
def getdirs():
return [f.path for f in os.scandir('.') if f.is_dir()]
def delempty(dir):
for i in [f[0] for f in os.walk(dir) if os.path.isdir(f[0])]:
try:
@karmanyaahm
karmanyaahm / list.txt
Created June 13, 2020 03:17
Comma seperated list of palindromic prime numbers up to 7 digits long (first 781)
2, 3, 5, 7, 11, 101, 131, 151, 181, 191, 313, 353, 373, 383, 727, 757, 787, 797, 919, 929, 10301, 10501, 10601, 11311, 11411, 12421, 12721, 12821, 13331, 13831, 13931, 14341, 14741, 15451, 15551, 16061, 16361, 16561, 16661, 17471, 17971, 18181, 18481, 19391, 19891, 19991, 30103, 30203, 30403, 30703, 30803, 31013, 31513, 32323, 32423, 33533, 34543, 34843, 35053, 35153, 35353, 35753, 36263, 36563, 37273, 37573, 38083, 38183, 38783, 39293, 70207, 70507, 70607, 71317, 71917, 72227, 72727, 73037, 73237, 73637, 74047, 74747, 75557, 76367, 76667, 77377, 77477, 77977, 78487, 78787, 78887, 79397, 79697, 79997, 90709, 91019, 93139, 93239, 93739, 94049, 94349, 94649, 94849, 94949, 95959, 96269, 96469, 96769, 97379, 97579, 97879, 98389, 98689, 1003001,1008001,1022201,1028201,1035301,1043401,1055501,1062601,1065601,1074701,1082801,1085801,1092901,1093901,1114111,1117111,1120211,1123211,1126211,1129211,1134311,1145411,1150511,1153511,1160611,1163611,1175711,1177711,1178711,1180811,1183811,1186811,1190911,1193911,1196911,12
@karmanyaahm
karmanyaahm / decrypt.py
Created June 5, 2020 04:02
Fractionated morse code decoder in python3.8 (orignally made for Morbit Cipher)
#derived from code by geeksforgeeks by karmanyaahm
MORSE_CODE_DICT = { 'A':'.-', 'B':'-...',
'C':'-.-.', 'D':'-..', 'E':'.',
'F':'..-.', 'G':'--.', 'H':'....',
'I':'..', 'J':'.---', 'K':'-.-',
'L':'.-..', 'M':'--', 'N':'-.',
'O':'---', 'P':'.--.', 'Q':'--.-',
'R':'.-.', 'S':'...', 'T':'-',
'U':'..-', 'V':'...-', 'W':'.--',
@karmanyaahm
karmanyaahm / ddclient.conf
Last active May 29, 2020 18:15
My Cloudflare ddclient setup on debian 10
daemon=600#check every 600 seconds - need to keep this long to not use too much getip
syslog=yes
protocol=cloudflare
use=web, web=dynamicdns.park-your-domain.com/getip
zone=example.com #domain.tld
ssl=yes
ttl=1
#for auth
#use either this
BEGIN MESSAGE.
jwsxxdZ97eWcDdd hASwV4JWr4ZIvzn DcRMw2EqlEYEe7n UIrOh14fFwuHMH8
IWviW5Hra2PySvi sxIstmAQM4eTCKq 6Xr2MZHgg7CqOSG 1GZUMugyTNfxL5q
tCLvxlYdPQ8F1Ca NZo2khnNjhtpeJ0 FpAze2cpGKc88LI QC9Wkk7O3bEpgtw
s8jn34VQGljTuLR 911BX0qs9cxvlYH i3bgX0aLMzWSiL.
END MESSAGE.