Skip to content

Instantly share code, notes, and snippets.

View prahladyeri's full-sized avatar
🏠
Working from home

Prahlad Yeri prahladyeri

🏠
Working from home
View GitHub Profile
@prahladyeri
prahladyeri / Crypto.java
Last active November 2, 2023 15:56
Basic implementation of text encryption/decryption in Java
package io.github.prahladyeri.utils;
import java.util.Arrays;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
public class Crypto
{
private String salt="972$%#@!)(><?|:}";
@prahladyeri
prahladyeri / checkpkg.py
Created November 2, 2023 13:50
Python script to check if specified package(s) are installed. Scan the requirements.txt instead, if no package specified.
##
# Check if specified package(s) are installed.
# Displays a GUI message if any aren't and asks to install.
import sys, os
import subprocess
import re
import importlib.util
import tkinter as tk
import tkinter.messagebox as messagebox
@prahladyeri
prahladyeri / pelican_to_jekyll.py
Created November 2, 2023 12:02
Script to convert existing markdown posts (*.md) in your content folder from pelican to jekyll format
##
# script to convert *.md posts in content folder to jekyll format
import os
import glob, re
def main():
files = glob.glob("content/*.md")
for fname in files:
lines = open(fname, encoding='utf8').readlines()
meta = {}
@prahladyeri
prahladyeri / hacker_news.user.js
Created June 22, 2019 11:56
Adding the missing "My Posts" and "My Comments" links on top of HackerNews website
// ==UserScript==
// @name HN Addons
// @namespace https://prahladyeri.com
// @version 0.1
// @description Add custom bells and whistles to HN
// @author Prahlad Yeri
// @match https://news.ycombinator.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @grant none
// ==/UserScript==
@prahladyeri
prahladyeri / repo_puller.py
Created June 22, 2019 11:52
Pelican Plugin to fetch a given user's github repos in order of last commits
##
# Repo Puller
#
# @description A plugin to pull your github repositories
# @author Prahlad Yeri<[email protected]>
# @license MIT
# @date 2019-06-20
#
# @modified:
# 2019-06-22: Cleaned up source, removed comments.
@prahladyeri
prahladyeri / gmail_classic.user.js
Created August 28, 2018 16:14
Userscript to add auto-refresh functionality to GMail Classic
// ==UserScript==
// @name GMail Classic
// @namespace https://prahladyeri.com
// @version 0.1
// @description Add refresh timer to GMail Classic
// @author Prahlad Yeri
// @match https://mail.google.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @grant none
// ==/UserScript==
@prahladyeri
prahladyeri / style.css
Created June 16, 2018 10:06
Stylesheet for the /r/FreelanceProgramming subreddit.
div.sidebox.submit.submit-link a,
div.sidebox.submit.submit-text a,
div.sidebox.create div.morelink a
{
background-color: teal;
color: white;
font-family: monospace, mono, "Courier New", Courier;
letter-spacing: 0.1em;
}
@prahladyeri
prahladyeri / split_tweet.py
Created September 22, 2017 03:37
Python script to split your long tweet into small chunks of 140 characters limit imposed by Twitter
#!/usr/bin/env python3
import os, sys
max_length = 140
def chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i + n]
if __name__ == "__main__":
@prahladyeri
prahladyeri / tree
Created September 21, 2017 12:53
Python-3 implementation of the tree linux command
#! /usr/bin/env python3
__author__ = "Prahlad Yeri"
__license__ = "MIT"
__version__ = "0.0.1"
import os, sys
def print_tree(dirname, pref = ""):
for item in os.listdir(dirname):
@prahladyeri
prahladyeri / batteryboy
Created September 10, 2017 03:50
A small script to check laptop battery life on linux
#!/usr/bin/env python3
import sys
import subprocess, os
from time import sleep, time
__author__ = "Prahlad Yeri"
__version__ = "1.0.7"
def execute_shell(command, error=''):
return execute(command, wait=True, shellexec=True, errorstring=error)