Skip to content

Instantly share code, notes, and snippets.

View GeekGawd's full-sized avatar
🎯
Focusing

Suyash Singh GeekGawd

🎯
Focusing
View GitHub Profile
@GeekGawd
GeekGawd / appimage_desktop_entry.py
Created October 25, 2024 16:13
Automate the process to create a desktop entry for an AppImage
import os
import subprocess
import shutil
import requests
def download_appimage(url, download_path):
print(f"Downloading AppImage from {url}...")
response = requests.get(url, stream=True)
with open(download_path, 'wb') as file:
shutil.copyfileobj(response.raw, file)
@GeekGawd
GeekGawd / callable.py
Created December 27, 2022 09:21 — forked from durden/callable.py
Clever way to use Python __call__ and __getattr__ to create web APIs that can map directly (dynamically) to actual API
class MyCallable(object):
def __init__(self, urlparts, callable):
self.urlparts = urlparts
self.callable = callable
def __call__(self, **kwargs):
print kwargs
print self.urlparts
def __getattr__(self, name):
# Return a callable object of this same type so that you can just keep
# chaining together calls and just adding that missing attribute to the
@GeekGawd
GeekGawd / callable.py
Created December 27, 2022 09:21 — forked from durden/callable.py
Clever way to use Python __call__ and __getattr__ to create web APIs that can map directly (dynamically) to actual API
class MyCallable(object):
def __init__(self, urlparts, callable):
self.urlparts = urlparts
self.callable = callable
def __call__(self, **kwargs):
print kwargs
print self.urlparts
def __getattr__(self, name):
# Return a callable object of this same type so that you can just keep
# chaining together calls and just adding that missing attribute to the