Skip to content

Instantly share code, notes, and snippets.

View amberj's full-sized avatar

Amber Jain amberj

View GitHub Profile
@amberj
amberj / create-folder-date-time.py
Created April 20, 2022 14:26
Create folder (with date & time as folder name) in Python 3
#!/usr/bin/env python3
from datetime import datetime
import os
now = datetime.now()
now_str = now.strftime("%m-%d-%Y_%H-%M-%S-%f")
# This will create a directory similar to this path:
# ./logs/04-20-2022_19-37-08/
temp_path="logs/" + now_str
@amberj
amberj / uncurl.py
Last active October 22, 2023 08:07
Convert curl to requests using uncurl
#!/usr/bin/env python3
import time
import uncurl
'''
This script uses: https://github.com/spulec/uncurl
To install: Setup virtualenv, then run:
@amberj
amberj / csv.py
Created October 21, 2023 04:26
Write Python list as a row to CSV
#!/usr/bin/env python3
import csv
def write_row_to_csv(filename, row_data_as_list, file_mode):
with open(filename, file_mode, newline='') as csvfile:
# creating a csv writer object
csvwriter = csv.writer(csvfile, delimiter=',', quotechar='"', quoting=csv.QUOTE_ALL)
# writing the data rows
csvwriter.writerow(row_data_as_list)
@amberj
amberj / beautifulsoup_snippets.py
Last active January 29, 2024 17:53
Beautiful Soup Snippets
#!/usr/bin/env python3
import requests
from curl_cffi import requests
from bs4 import BeautifulSoup
'''
requirements.txt