Skip to content

Instantly share code, notes, and snippets.

@sphinxid
sphinxid / get_my_public_ip.sh
Last active June 21, 2023 09:22
Using ipgue.com to get your public IP.
#!/bin/bash
IP=`wget -qO - kodelatte.com`
echo $IP
@sphinxid
sphinxid / whois-asn-ip
Created January 26, 2023 16:08 — forked from bmatthewshea/whois-asn-ip
BASH script that uses 'whois' to lookup ASN number and display all IP4 CIDR associated to it.
#!/bin/bash
# whois-asn-ip (bash script)
# By: Brady Shea - March 15th 2020
# https://www.holylinux.net
# https://gist.github.com/bmatthewshea/dc427f0c30b82429931d5896f548d550
# The whois server to use:
WHOISHOSTNAME=whois.ripe.net
# Uncomment to remove temp files
#DEL_TEMP=true
@sphinxid
sphinxid / simple-api-client-server-pow-simulation.py
Last active October 13, 2024 06:55
This code simulates a client-server interaction using a Proof-of-Work (PoW) system. In such systems, the client must solve a computational challenge set by the server in order to have its request processed. This particular code makes use of SHA3-256 hashing and requires the hash of a unique challenge and a nonce to have a specific number of lead…
import hashlib
import hmac
import time
import secrets
import random
# Secret Key for HMAC (In a real-world scenario, this should be stored securely)
SECRET_KEY = b"SayaOrangPalingGantengSedunia" # Change this in production
# Difficulty (number of leading zeroes required in the hash)
@sphinxid
sphinxid / redis-test.py
Last active August 9, 2023 10:11
python 3 script to test connection to a redis and do simple GET/SET
import redis
def test_redis(host, port, password=None):
# Connect to Redis
client = redis.StrictRedis(host=host, port=port, password=password, decode_responses=True)
# Set a key-value pair
client.set("test_key", "Hello Redis!")
# Get the value of the key
@sphinxid
sphinxid / eye_care.py
Created October 21, 2024 06:17
A simple yet effective command-line application that implements the 20-20-20 rule for reducing eye strain while working on computers. The rule suggests that every 20 minutes, you should look at something 20 feet away for 20 seconds.
import time
import datetime
import os
import platform
def clear_screen():
os.system('cls' if platform.system() == 'Windows' else 'clear')
def play_sound(repeat=10):
for _ in range(repeat):
@sphinxid
sphinxid / settings.json
Created November 17, 2024 08:51
vscode microsoft gallery url
"extensions.gallery": {
"serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery",
"cacheUrl": "https://vscode.blob.core.windows.net/gallery/index",
"itemUrl": "https://marketplace.visualstudio.com/items"
}
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/37.0.2062.94 Chrome/37.0.2062.94 Safari/537.36
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/600.8.9 (KHTML, like Gecko) Version/8.0.8 Safari/600.8.9
Mozilla/5.0 (iPad; CPU OS 8_4_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12H321 Safari/600.1.4
Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:40.0)
#!/usr/bin/env python3
import argparse
import mysql.connector
import time
import random
import signal
import sys
from datetime import datetime
from typing import Optional
@sphinxid
sphinxid / gist:ef4edc12f0d48c01a2eb20d812448778
Created April 13, 2025 10:53
YABS Benchmark - VPS NevaCloud Nevalite - 2core 2GBram 30GBdisk @ 100rb/bulan (20250413)
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
# Yet-Another-Bench-Script #
# v2025-01-01 #
# https://github.com/masonr/yet-another-bench-script #
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
Sun Apr 13 10:09:20 UTC 2025
Basic System Information:
---------------------------------
@sphinxid
sphinxid / gist:9fa6674457fc563cf9aeb10e1ba4649a
Created April 13, 2025 10:53
YABS Benchmark - BiznetGio NeoLite SS 2.2 - 2core 2GBram 60GBdisk @ 100rb/bulan
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
# Yet-Another-Bench-Script #
# v2025-01-01 #
# https://github.com/masonr/yet-another-bench-script #
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
Sun Apr 13 16:57:24 WIB 2025
Basic System Information:
---------------------------------