-
Change font
(Powerline font to suport my
$PS1
with a git character: see.zshrc
, and needapt install fonts-powerline
/powerline-fonts-git
for arch)"terminal.integrated.fontFamily": "FiraCode Nerd Font Mono"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# List PRs you are requested to review | |
gh search prs --review-requested=@me --json url,state | jq -r '.[] | "\(.state)\t\(.url)"' | sed -E 's/open/\x1B[32m&\x1B[0m/g; s/merged/\x1B[35m&\x1B[0m/g' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3.8 | |
# Author: Teshan Liyanage <[email protected]> | |
from Bard import Chatbot | |
# pip install GoogleBard | |
# tokens from Bard webpage: inspect -> Application -> Cookies -> bard.google.com -> __Secure-1PSID, __Secure-1PSIDTS | |
# ANSI colors | |
c_b, c_nc = "\033[94m", "\033[0m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3.8 | |
# Author: Teshan Liyanage <[email protected]> | |
import readline | |
import openai | |
from Bard import Chatbot # from https://github.com/acheong08/Bard | |
import time | |
# ANSI colors | |
c_b, c_g, c_gr, c_nc = "\033[94m", "\033[32m", "\033[30m", "\033[0m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3.8 | |
# Author: Teshan Liyanage <[email protected]> | |
import readline | |
import openai | |
openai.api_key = "<get from https://platform.openai.com/account/api-keys>" | |
# ANSI colors | |
c_b, c_g, c_gr, c_nc = "\033[94m", "\033[32m", "\033[30m", "\033[0m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To hide stderr from command output (e.g. `find -name "something" NOERR`) | |
alias -g NOERR="2>/dev/null" | |
# epoch time(sec) to date - `epocht 123456789` or `echo 123456789 | epocht` | |
epocht() { | |
if [ -z $1 ]; then read ip; else ip=$1; fi | |
date -d @$ip +"%Y-%m-%d %T" | |
} | |
# find text in directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!python3 | |
# Author: Teshan Liyanage <[email protected]> | |
# Usage: ./search_font.py '^git' | |
import freetype, sys, re | |
def findg(f, s): | |
ret = [] | |
for c,g in f.get_chars(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set up the prompt | |
# reference: https://www.youtube.com/watch?v=eLEo4OQ-cuQ&ab_channel=LukeSmith | |
# https://gist.github.com/LukeSmithxyz/e62f26e55ea8b0ed41a65912fbebbe52 | |
autoload -U colors && colors | |
# PS1='%(?..%F{red}%?)%f[%B%F{blue}%~%f%b]%F{red}>%f ' | |
# PS1='%(?.%F{green}√.%F{red}?%?)%f[%B%F{blue}%~%f%b]%F{red}>%f ' | |
# History in cache directory: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: Teshan Liyanage <[email protected]> | |
import imageio | |
import cv2 | |
def convert(vid, frm , to, outfile, fps): | |
cap = cv2.VideoCapture(vid) | |
image_lst = [] | |
vid_fps = cap.get(cv2.CAP_PROP_FPS) | |
assert vid_fps >= fps, f"Video fps {vid_fps} is smaller thank provided fps {fps}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: Teshan Liyanage <[email protected]> | |
import os | |
from urllib.parse import urlparse | |
import requests | |
import re | |
def is_valid_url(x): | |
try: | |
result = urlparse(x) |
NewerOlder