Skip to content

Instantly share code, notes, and snippets.

Avatar
🔘

Akash Mahanty akamhy

🔘
View GitHub Profile
@akamhy
akamhy / huffman.py
Created Jan 20, 2023
Compress The Data - Huffman Coding
View huffman.py
import heapq
from collections import defaultdict
def huffman_encoding(data_list):
"""
Huffman encoding algorithm.
"""
freq_table = defaultdict(int)
for data in data_list:
@akamhy
akamhy / AllGitRepositoryCommitters.md
Created Jan 24, 2022
List all committers to a git repository (on the working branch)
View AllGitRepositoryCommitters.md

List all committers to a git repository (on the working branch)

git log --reverse --format="%aN <%aE>" | cat | sort -u

Example:

akamhy at device in ~/projects/yt-dlp on master
$ git log --reverse --format="%aN <%aE>" | cat | sort -u
@akamhy
akamhy / cli.py
Last active Dec 24, 2021
VideoHash CLI interface
View cli.py
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
#
# In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
@akamhy
akamhy / 2hrvideo.md
Created Oct 11, 2021
2 hour count up video
We couldn’t find that file to show.
@akamhy
akamhy / youtube_playlist_duration.py
Created Oct 11, 2021
YouTube PlayList Duration from command-line
View youtube_playlist_duration.py
import re
import requests
def playlist_data(search_string):
end_point = "https://ytplaylist-len.herokuapp.com"
params = {"search_string": search_string.strip()}
text = requests.post(end_point, data=params).text
number_of_videos = (
re.search(r"<p>No of videos : ([0-9]*?)</p>", text).group(1).strip()
@akamhy
akamhy / example_cdx.py
Last active Jan 5, 2021
Cdx Pagination API, wildcard search
View example_cdx.py
from waybackpy import Cdx # waybackpy >= 2.3.3
url = "https://www8.gsb.columbia.edu/cbs-directory/detail/*"
user_agent = "Your-apps-user-agent"
cdx = Cdx(url=url, user_agent=user_agent)
snapshots = cdx.snapshots()
for snapshot in snapshots:
print(snapshot.archive_url)
View keybase.md

Keybase proof

I hereby claim:

  • I am akamhy on github.
  • I am akamhy (https://keybase.io/akamhy) on keybase.
  • I have a public key ASCQISpjHRJMMwcajs32CvkN7FFDEferofdHpVrMxh--wQo

To claim this, I am signing this object: