Skip to content

Instantly share code, notes, and snippets.

View sarkrui's full-sized avatar
🚀
Kicking off

Sark sarkrui

🚀
Kicking off
View GitHub Profile
#!/bin/bash
# Check if xclip is installed, install if not
if ! command -v xclip &>/dev/null; then
apt-get update
apt-get install -y xclip
fi
# Check if clipboard is empty
if [[ -z "$(xclip -o -selection clipboard 2>/dev/null)" ]]; then
@sarkrui
sarkrui / install-cloudflared.sh
Created October 31, 2023 13:37
Install cloudflared
#!/bin/bash
# Identify the operating system and architecture
OS=$(uname -s)
ARCH=$(uname -m)
# Install based on system distribution
if [ "$OS" == "Linux" ]; then
if [ "$ARCH" == "x86_64" ]; then
curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
@sarkrui
sarkrui / README.md
Last active November 2, 2023 03:19
README for Netflix Verify

ARM64

wget -O /usr/local/bin/nf https://github.com/sjlleo/netflix-verify/releases/download/v3.1.0/nf_linux_arm64 && chmod +x /usr/local/bin/nf && ./nf

AMD64

wget -O /usr/local/bin/nf https://github.com/sjlleo/netflix-verify/releases/download/v3.1.0/nf_linux_amd64 && chmod +x /usr/local/bin/nf && ./nf
#!/bin/bash
# Function to fetch a specific or latest release from GitHub
fetch_release() {
if [ -z "$1" ]; then
echo "Fetching the latest release..."
echo $(curl -s https://api.github.com/repos/rapiz1/rathole/releases/latest | grep "browser_download_url.*$FILE_NAME" | cut -d '"' -f 4)
else
echo "Fetching the release for tag $1..."
echo $(curl -s https://api.github.com/repos/rapiz1/rathole/releases/tags/$1 | grep "browser_download_url.*$FILE_NAME" | cut -d '"' -f 4)
@sarkrui
sarkrui / main.sh
Created October 24, 2023 13:58
Remove Duplicates and Collections
(async () => {
var dupPane = Zotero.getZoteroPanes()[0];
var duplicatesCollection = dupPane.getSelectedCollection();
for (var i = 0; i < 8000; i++) {
await new Promise(r => setTimeout(r, 200));
let selectedItems = dupPane.getSelectedItems();
// Filter selected items by their type (assuming first selected item is representative)
@sarkrui
sarkrui / ip.sh
Last active August 4, 2023 09:07
Change Ethernet IP Address
#!/bin/ash
# Check if an argument is passed
if [ "$#" -ne 1 ]; then
echo "Usage: $0 ip"
exit 1
fi
ip=$1
@sarkrui
sarkrui / danted.sh
Last active August 2, 2023 13:21
Creating danted services and config in bulk
#!/bin/bash
danted_path="/usr/sbin/danted"
function scan_ips() {
declare -a down_ips
echo "Pinging IP range 158.132.58.3 to 158.132.58.254 in 20 threads. This may take a moment..."
while read -r ip; do
down_ips+=("$ip")
done < <(for i in {3..254}; do echo 158.132.58.$i; done | xargs -I% -P 20 bash -c 'ping -c 1 -W 1 % > /dev/null && echo "% is down"')
@sarkrui
sarkrui / install-cloudflared.md
Created May 31, 2023 12:19
Install Cloudflared on Alpine Linux

Cloudflared Setup Guide

This guide will walk you through setting up Cloudflared on your system.

Pre-Requisites

You need to have administrative (sudo) access to your system.

Here are the steps to install Cloudflared.

@sarkrui
sarkrui / ip.sh
Last active May 31, 2023 14:09
Scan and Change IP on Alpine Linux
#!/bin/sh
# Parsing command line arguments
while [ "$1" != "" ]; do
case $1 in
--ip ) shift
IP=$1
;;
* ) echo "Invalid argument"
exit 1
@sarkrui
sarkrui / install.sh
Created May 30, 2023 03:53
Deploy Amazon Price Tracker
# Installing dependencies
DEBIAN_FRONTEND=noninteractive && \
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub > /usr/share/keyrings/chrome.pub && \
echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/chrome.pub] http://dl.google.com/linux/chrome/deb/ stable main' > /etc/apt/sources.list.d/google-chrome.list && \
apt update -y && \
apt install -y google-chrome-stable
apt install xvfb -y
# Install miniconda