Skip to content

Instantly share code, notes, and snippets.

View arunpt's full-sized avatar
☢️
Active

W4RR10R arunpt

☢️
Active
View GitHub Profile
@arunpt
arunpt / grade.c
Created June 10, 2020 13:01
C program to find grade
/*
* C program to find grade of a student from marks
*/
#include<stdio.h>
#include<conio.h>
void main()
{
int num;
@arunpt
arunpt / hmac.py
Last active May 4, 2020 09:11
Hotstar Auth token Generator
import hmac
import hashlib
import time
def hsauth():
AKAMAI_KEY = b'\x05\xfc\x1a\x01\xca\xc9\x4b\xc4\x12\xfc\x53\x12\x07\x75\xf9\xee'
st = int(time.time())
exp = st + 6000
auth = 'st=%d~exp=%d~acl=/*' % (st, exp)
auth += '~hmac=' + hmac.new(AKAMAI_KEY, auth.encode(), hashlib.sha256).hexdigest()
import requests
from bs4 import BeautifulSoup
session = requests.Session()
session.headers = {"User-Agent": "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.111 Mobile Safari/537.36"}
url = "https://www.manoramaonline.com/news/latest-news.html"
content = session.get(url).content
soup = BeautifulSoup(content, "html.parser")
match = soup.find_all('div', {"class": "story-content-blk"})
for datas in match:
@arunpt
arunpt / fbviaselenium.py
Created April 23, 2020 12:33
Python code snippet for logging into facebook using selenium webdrivers
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
user_name = "EMAILID"
password = "PASSWORD"
driver = webdriver.Chrome()
driver.get("https://www.facebook.com")
element = driver.find_element_by_id("email")
element.send_keys(user_name)
element = driver.find_element_by_id("pass")
element.send_keys(password)