Skip to content

Instantly share code, notes, and snippets.

View imhemish's full-sized avatar

Hemish imhemish

View GitHub Profile
@imhemish
imhemish / demo.blp
Created December 8, 2023 12:28
Menu inside a headerbar (Gtk4 with blueprint)
using Gtk 4.0;
using Adw 1;
menu menu {
submenu {
label: _("File");
item {
label: _("New");
action: "app.new";
}
@imhemish
imhemish / main.py
Created March 28, 2023 14:51
Fetch accepted pull requests at GitHub in markdown format
import json
from requests import get
x = get("https://api.contributed.jdocklabs.co.uk/user/imhemish")
y = json.loads(x.text)
print("# Accepted pull requests at GitHub")
#!/usr/bin/env python3
from pydownsongs import get_meta, add_meta
from sys import argv
args = argv[1:]
for item in args:
add_meta(get_meta(item), item)
@imhemish
imhemish / win10-toggle-theme.py
Last active May 14, 2021 08:57
win10-toggle-theme
# Python3
# Double click this file to change app mode theme in Windows 10
# Dark theme is 0 and light theme is 1
import os
import subprocess
themecolour = int(os.popen("reg query HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize /v AppsUseLightTheme").read().rstrip()[-1])
changedtheme = str(int(not bool(themecolour)))
command = ['reg.exe', 'add', 'HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize',
'/v', 'AppsUseLightTheme', '/t', 'REG_DWORD', '/d', changedtheme, '/f']
subprocess.call(command)
# This script downloads and installs Chrome on Debian based distros
echo Please connect to internet first and press enter
read enter
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install ./google-chrome-stable_current_amd64.deb --install-recommends -y
@imhemish
imhemish / mintxfce20.1configure.sh
Last active May 10, 2021 13:49
mintxfce20.1configure
# This script is meant to debloat and configure Linux Mint XFCE 20.1 according to my needs and should not be used on any other edition or distro
echo Please connect to Internet first and press enter
read enter
echo Installing python3-pip, python3-tk, tk tcl, python3-setuptools and git
sudo apt install python3-pip python3-tk tk tcl python3-setuptools git --no-install-recommends
echo Removing mint welcome
sudo apt autoremove --purge mintwelcome -y
echo Removing celluloid, mpv and installing totem aka gnome-videos
sudo apt autoremove --purge celluloid mpv -y
sudo apt install totem -y
# Play videos from youtube in vlc
# Make sure that vlc is on path
import requests # pip install requests
import random
import os
import googlesearch # pip install google
try:
def gSearch(term):
searchreq = list(googlesearch.search(term, stop=10, num=10, user_agent=(str(randomUsrAgent()))))
@imhemish
imhemish / gofile.py
Last active May 14, 2021 09:00
gofile
# Upload files to gofile using their api
import requests
import json
import sys
filename = (sys.argv)[1] # You need to pass the path of file as arguement
getserver = "https://apiv2.gofile.io/getServer"
temp = requests.get(getserver)
myfiles = {'file': open(filename ,'rb')}
server = (json.loads(temp.text))["data"]["server"]
url = "https://"+server+".gofile.io/uploadFile"
@imhemish
imhemish / save.php
Last active March 25, 2021 08:17
saveTextData
<?php
if(isset($_POST['textdata']))
{
$data=$_POST['textdata'];
$fp = fopen('data.txt', 'a');
fwrite($fp, $data);
fclose($fp);
}
@imhemish
imhemish / renameTitleCase.py
Created March 12, 2021 08:36
renameTitleCase
# Replace mp3 with whatever files you want to rename to title case
# Original: this is a gist
# After rename: This Is A Gist
import os
listing = os.listdir()
filtered = []
work = []
for item in listing:
if ".mp3" in item:
filtered.append(item)