Skip to content

Instantly share code, notes, and snippets.

View drushadrusha's full-sized avatar
🌴
On vacation forever

drushadrusha drushadrusha

🌴
On vacation forever
View GitHub Profile
@drushadrusha
drushadrusha / obsidian_lastfm.php
Created September 24, 2024 01:27
Add Last.fm scrobble history in Obsidian
<?php
// phpcs:disable
// take dump here https://benjaminbenben.com/lastfm-to-csv/
$csv = file_get_contents("anarki728.csv");
$resultFolder = "result";
$verbose = false;
$dayFormat = "d.m.Y";
$arr = explode("\n", $csv);
@drushadrusha
drushadrusha / mapkit.php
Created August 22, 2024 22:02
Create static MapKit snapshot using PHP
<?php
// composer require mapkit/jwt
require_once('vendor/autoload.php');
use Mapkit\JWT;
$privateKey = file_get_contents('private.p8'); // Private key
$teamId = ''; // Team ID
$keyId = ''; // Key ID
$snapshotPath = "/api/v1/snapshot?center='".$lat.",".$lng."'&size=400x120&scale=2&z=9";
$signature = JWT::getToken($privateKey, $keyId, $teamId);
"""
code from
https://www.reddit.com/r/raspberry_pi/comments/szgawv/using_a_raspberry_pi_to_continuously_scan_for/
Scan for iBeacons.
Copyright (c) 2022 Koen Vervloesem
SPDX-License-Identifier: MIT
"""
import asyncio
@drushadrusha
drushadrusha / gemini.php
Created July 7, 2023 17:15
PHP Gemini Client
<?php
// This is a simple PHP script that can be used to fetch a Gemini URL and return the contents.
// Example usage:
try {
echo gemini_get_contents('gemini://gemini.circumlunar.space');
} catch(Exception $e) {
echo $e->getMessage();
@drushadrusha
drushadrusha / wireguard.sh
Last active March 3, 2023 17:40
How to make Wireguard VPN input and output traffic on different interfaces.
## This will work with installation made by this script.
## https://github.com/angristan/wireguard-install
echo "100 wg" >> /etc/iproute2/rt_tables ## Create new routing table
ip rule add from 10.66.66.1/24 table wg ## Send all traffic from Wireguard network to wg routing table
ip route add default via 192.168.1.1 dev ens7 table wg ## Set default gateway for wg routing table
iptables -t nat -A POSTROUTING -o ens7 -s 10.66.66.1/24 -j MASQUERADE ## Make it working with Wireguard NAT
## Also you could try something like this.
@drushadrusha
drushadrusha / systemd_telegram
Created January 27, 2023 06:28
systemd service notifications in telegram without fucking python scripts and other trash
ExecStartPost=/bin/bash -c "SERVICE_NAME=%n;curl \"https://api.telegram.org/botTOKEN/sendMessage?chat_id=20515652&text=✅ Service $SERVICE_NAME started on $HOSTNAME\""
ExecStopPost=/bin/bash -c "SERVICE_NAME=%n;curl \"https://api.telegram.org/botTOKEN/sendMessage?chat_id=20515652&text=❌ Service $SERVICE_NAME stopped on $HOSTNAME\""
@drushadrusha
drushadrusha / mac-vendor.txt
Created January 1, 2023 15:30 — forked from aallan/mac-vendor.txt
List of MAC addresses with vendors identities
000000 Officially Xerox
000001 SuperLAN-2U
000002 BBN (was internal usage only, no longer used)
000003 XEROX CORPORATION
000004 XEROX CORPORATION
000005 XEROX CORPORATION
000006 XEROX CORPORATION
000007 XEROX CORPORATION
000008 XEROX CORPORATION
000009 powerpipes?
@drushadrusha
drushadrusha / Half Life on Mac M1.sh
Last active March 3, 2023 17:32
How to build and run Half-Life 1 on M1 natively.
##
## Guide to build and run half-life 1 on M1 processor
##
##
## This is not a script.
## This may be not be accurate.
## Execute all commands by yourself and only if you are understand their meaning.
##
@drushadrusha
drushadrusha / virt-manager.sh
Created September 1, 2022 13:56
Run virt-manager in browser via GTK Broadway
#!/bin/bash
nohup /usr/bin/broadwayd :5 &> /var/log/broadway.log &
export GDK_BACKEND=broadway
export BROADWAY_DISPLAY=:5
virt-manager &
# virt-manager will be available at localhost:8085