Skip to content

Instantly share code, notes, and snippets.

View naranyala's full-sized avatar
🎯
F11 - back to the context

FMH (@gema_naranyala) naranyala

🎯
F11 - back to the context
View GitHub Profile
@naranyala
naranyala / snake.v
Created April 11, 2025 10:12
snake game in v (vlang)
import gg
import gx
import math
import rand
import sokol.audio
import os.asset
import sokol.sgl
const designed_width = 600
const designed_height = 800
@naranyala
naranyala / fix-puppeter-could-not-find-chrome.txt
Last active March 29, 2025 22:45
fix puppeteer error: Could not find Chrome; you need to specifiy the chrome version, the latest one not guarantee, just use suggested version from the error
> npx puppeteer browsers install chrome # wrong
# example version
> npx puppeteer browsers install [email protected] # correct
@naranyala
naranyala / router.ts
Created February 11, 2025 09:43
this is mithril.js file-based routing
import m from "mithril";
// Auto-import all `.ts` and `.js` files inside `pages/`
const modules = import.meta.glob("./pages/**/*.{ts,js}");
import { Layout } from "./layouts/default";
const routes: Record<string, any> = {};
// Define a simple 404 component
@naranyala
naranyala / clone-repo-with-username.py
Last active March 26, 2025 04:21
clone-repo-with-username.py
import os
import re
import subprocess
import sys
from pathlib import Path
def clone_repo(repo_url, target_path="."):
# Define patterns for GitHub, GitLab, and Codeberg URLs
# Support both HTTPS and SSH-style URLs
patterns = [
@naranyala
naranyala / randomize_windows_wallpaper.py
Created December 28, 2024 14:29
randomize windows wallpaper using python code
import os
import random
import ctypes
# Define the path to the directory containing wallpapers
WALLPAPER_DIRECTORY = "D:\\your-wallpaper-collection\\nested-dir\\"
def set_wallpaper(image_path):
"""
Sets the desktop wallpaper using the Windows API.
#!/bin/bash
# Get the application directory from the command line argument
APP_DIR="$1"
# Set installation path
INSTALL_DIR="/opt" # Standard directory for optional apps
BIN_PATH="/usr/local/bin" # Path where we symlink the executable
# Check if APP_DIR was provided
#!/bin/bash
# Check if the AppImage file path is provided
if [ -z "$1" ]; then
echo "Error: Please provide the path to the AppImage file as the first argument."
exit 1
fi
# Path to the AppImage file
appimage_path="$1"
@naranyala
naranyala / sizeof.sh
Created September 9, 2024 03:59
intuitive command to show file or directory size
#!/bin/bash
# Check if an argument (file or directory) is provided
if [ -z "$1" ]; then
echo "Usage: sizeof <file_or_directory>"
exit 1
fi
# Use du to calculate size in bytes, then dynamically adjust for KB, MB, GB, etc.
size_in_bytes=$(du -sb "$1" | cut -f1)
#!/bin/bash
# Update package list
echo "Updating package list..."
sudo apt update
# Install PHP
echo "Installing PHP..."
sudo apt install -y php8.0
#!/bin/bash
# Function to print a message in a specific format
print_message() {
echo "--------------------------------------------------"
echo "$1"
echo "--------------------------------------------------"
}
# Function to install Homebrew