Skip to content

Instantly share code, notes, and snippets.

@bpanthi977
bpanthi977 / embedimages.py
Created July 6, 2023 16:55
Image Indexing and Search (like Google Photos)
#!/usr/bin/env python
import sys
import os
import shutil
import urllib.parse
import base64
import numpy as np
import csv
from PIL import Image
import time
@bpanthi977
bpanthi977 / lisp-to-latex.el
Last active February 6, 2022 03:24
Convert mathematical lisp expression to LaTeX
;; improved from https://emacs.stackexchange.com/a/70360
(defvar lisp2latex-functions '(sin cos tan))
(defvar lisp2latex-maybe-enclose? nil)
(defun lisp2latex-maybe-enclose (form)
(let* ((lisp2latex-maybe-enclose? nil)
(latex (lisp2latex form)))
(if lisp2latex-maybe-enclose?
(format "(%s)" latex)
latex)))
@bpanthi977
bpanthi977 / rclone-filter.lisp
Last active February 27, 2022 09:19
Create rclone filter file for given directory by parsing filter files recursively inside the given directory.
(require 'asdf)
(let ((*trace-output* (make-string-output-stream)))
(asdf:load-systems :alexandria :serapeum :iolib/os))
(defpackage #:rclone-filter
(:use #:cl)
(:local-nicknames (#:a #:alexandria)
(#:s #:serapeum)))
@bpanthi977
bpanthi977 / rclone-exclude.py
Last active November 5, 2021 11:07
Create rclone --exclude-from list by recursively visting .gitignore files
#!/usr/bin/env python
import os
import subprocess
def append_parentpath(path, ignore_string):
return [path + '/' + line for line in ignore_string.splitlines()]
def traverse_and_generate(path, printpath=""):
dirs = os.listdir(path)
if '.git' in dirs: