Skip to content

Instantly share code, notes, and snippets.

View ImBIOS's full-sized avatar
Working on something useful - stay tuned!

Imamuzzaki Abu Salam ImBIOS

Working on something useful - stay tuned!
View GitHub Profile
@ImBIOS
ImBIOS / wait_for_internet.sh
Created October 30, 2024 02:04
This Bash script is designed to help you automatically execute commands once an internet connection is detected. Ideal for developers, sysadmins, and power users, this script repeatedly pings a specified server (default: Google) until a successful response is received, then runs any command you specify. Use it to automate tasks that depend on in…
#!/bin/bash
# Check if a command is passed
if [ -z "$1" ]; then
echo "Started internet watchdog!"
else
echo "Usage: $0; <command>"
exit 1
fi
@ImBIOS
ImBIOS / .bashrc
Created July 30, 2024 01:43
Conda not working in Intel DevCloud
# @see https://community.intel.com/t5/Intel-DevCloud/Python-3/m-p/1591140/highlight/true#M9836
export PATH='/glob/development-tools/versions/oneapi/2024.1/oneapi/intelpython/envs/pytorch/bin/:'${PATH}
export PATH='/glob/development-tools/versions/oneapi/2024.1/oneapi/intelpython/condabin/:'${PATH}
@ImBIOS
ImBIOS / find_best_vscode_node.sh
Created July 30, 2024 00:58
Find Best PBS Node for VSCode Server
#!/bin/bash
# Function to assign a rank to a node based on its properties
get_node_rank() {
local properties="$1"
case "$properties" in
*xeon,spr,plat8480,ram512gb,netgbe,dual_gpu,hbm2e,gpu,max,max_1100*) echo 1 ;;
*xeon,spr,max9480,ram256gb,netgbe,batch,hbm*) echo 2 ;;
*xeon,icx,plat8380,ram2tb,net1gbe,batch*) echo 3 ;;
*xeon,icx,gold6348,ramgb,netgbe,jupyter,batch*) echo 4 ;;
@ImBIOS
ImBIOS / devcloud_free_with_properties.sh
Last active July 30, 2024 00:56
This bash script retrieves and displays the properties of all free nodes in a PBS (Portable Batch System) cluster.
for node in $(pbsnodes -l free | awk '{print $1}'); do
echo "$node"
pbsnodes "$node" | awk '/state = free/ {state=$0} /properties =/ {prop=$0} END {print " " state; print " " prop}'
echo ""
done
@ImBIOS
ImBIOS / addFillToSVGs.sh
Last active July 15, 2024 06:48
Automatically Add fill="currentColor" to SVG Files. This shell script recursively scans through a directory and its subdirectories to find all SVG files and adds fill="currentColor" to all path elements that don't already have a fill attribute. This is particularly useful for ensuring that SVG icons inherit the current text color when used in we…
#!/bin/bash
# Ensure the script runs in the directory where SVG files are located
cd /path/to/your/svg/files
# Loop through all SVG files in the current directory
for file in *.svg; do
# Add fill="currentColor" to each SVG file using sed
sed -i 's/<svg /<svg fill="currentColor" /g' "$file"
done
(
function() {
let div = '<div id="progress" style="position: fixed; z-index: 1000; background-color: #424c59; padding: 1em; bottom: 1em; left: 1em; border-radius: 4px; box-shadow: 1px 2px 12px 0 black">Clearing wishlist...</div>';
document.querySelector("body").innerHTML+=div;
let progress = document.getElementById("progress");
let promises = [], count = 0;
for (let id of g_Wishlist.rgAllApps) {
let form = new FormData();
form.append('sessionid', g_sessionID);
@ImBIOS
ImBIOS / Remove videos from Youtube Watch Later playlist.md
Created February 12, 2024 07:26 — forked from astamicu/Remove videos from Youtube Watch Later playlist.md
Script to remove all videos from Youtube Watch Later playlist

UPDATED 22.11.2022

It's been two years since the last update, so here's the updated working script as per the comments below.

Thanks to BryanHaley for this.

setInterval(function () {
    video = document.getElementsByTagName('ytd-playlist-video-renderer')[0];

 video.querySelector('#primary button[aria-label="Action menu"]').click();
@ImBIOS
ImBIOS / urlHelper.test.ts
Created September 23, 2023 10:17
Bun test for urlHelper custom react hook
import { renderHook } from '@testing-library/react'
import { describe, expect, it, spyOn } from 'bun:test'
import * as nextNavigation from 'next/navigation'
import { useUrlHelper } from '@/hooks/urlHelper'
const { ReadonlyURLSearchParams } = nextNavigation
// // Mock the Next.js hooks
// jest.mock('next/navigation', () => ({
@ImBIOS
ImBIOS / unlock_gpt_4.py
Created July 30, 2023 09:48
Script to unlock GPT-4 in OpenAI API
# Use pipenv to auto load OPENAI KEY
import sys
import time
import json
import signal
import openai
# Constants
TOKENS_PER_MINUTE = 90000 - 100 # 90000 tokens per minute - 100 for safety
REQUESTS_PER_MINUTE = 3500 - 100 # 3500 requests per minute - 100 for safety
This file has been truncated, but you can view the full file.
[{"traceId":"246038dbee31cf99","name":"hot-reloader","id":1,"timestamp":140675272083,"duration":23,"tags":{"version":"13.4.10-canary.8"},"startTime":1689309044022},{"traceId":"246038dbee31cf99","parentId":1,"name":"start","id":2,"timestamp":140675272654,"duration":1,"tags":{},"startTime":1689309044022},{"traceId":"246038dbee31cf99","parentId":2,"name":"get-version-info","id":3,"timestamp":140675273010,"duration":2010979,"tags":{},"startTime":1689309044023},{"traceId":"246038dbee31cf99","parentId":2,"name":"clean","id":4,"timestamp":140677284024,"duration":165,"tags":{},"startTime":1689309046034},{"traceId":"246038dbee31cf99","parentId":5,"name":"get-page-paths","id":6,"timestamp":140677286385,"duration":512,"tags":{},"startTime":1689309046036},{"traceId":"246038dbee31cf99","parentId":5,"name":"create-pages-mapping","id":7,"timestamp":140677286911,"duration":170,"tags":{},"startTime":1689309046037},{"traceId":"246038dbee31cf99","parentId":5,"name":"create-entrypoints","id":8,"timestamp":140677287090,"duration"