Skip to content

Instantly share code, notes, and snippets.

View bnikanjam's full-sized avatar
Focusing

Babak Nikanjam bnikanjam

Focusing
  • Amazon AWS
  • San Francisco Bay Area
View GitHub Profile
@bnikanjam
bnikanjam / format_json_files.py
Created January 22, 2023 02:13
Format all json files from in the current path and all sub-directories
import os
import json
def format_json_file(file_path):
# Open the JSON file
try:
with open(file_path, "r") as json_file:
# Load the JSON data from the file
json_data = json.load(json_file)
@bnikanjam
bnikanjam / install_java_lts_n_maven.sh
Created July 22, 2022 06:28
Install latest Java LTS and MAven on Amazon Linux 2
#!/bin/bash
# Install and select the latest Java LTS on Amazon Linux 2
# Install Maven
# Install latest Java LTS
sudo yum install java
echo "Select the latest Java LTS"
sudo alternatives --config java
@bnikanjam
bnikanjam / most_popular_repos.py
Last active April 27, 2019 05:02
Top Github Repos
@bnikanjam
bnikanjam / post_gist.py
Created April 27, 2019 04:12
Post input function source code to your Github gist.
def post_gist(func_name, git_token, gist_description=None, public=True):
"""Post input function source code to your Github gist."""
from inspect import getsource
from github import Github, InputFileContent
if not gist_description:
gist_description = func_name.__doc__
me = Github(git_token).get_user()
code = {func_name.__name__ + '.py': InputFileContent(getsource(func_name))}