Skip to content

Instantly share code, notes, and snippets.

View 0x48piraj's full-sized avatar

Piyush Raj 0x48piraj

View GitHub Profile
wget $(npm view @mediapipe/face_mesh dist.tarball)
@0x48piraj
0x48piraj / README.md
Created August 11, 2025 23:39
Extract a frame, manually determine crop coordinates, and use FFmpeg to crop a video with zero quality loss.

🎞️ FFmpeg Video Cropping Workflow

✅ Step 1: Extract a Frame for Analysis

Extract a single frame (as PNG) from the video at a chosen timestamp:

ffmpeg -ss 00:00:05 -i input.mp4 -frames:v 1 -q:v 2 frame.png
@0x48piraj
0x48piraj / README.md
Created July 24, 2025 02:19
Data Recovery – Rescue Guide (Linux/Ubuntu)

Data Recovery – Rescue Guide (Linux/Ubuntu)

A step-by-step guide for rescuing data from damaged or unreadable SD cards using Live Ubuntu, ddrescue, photorec, and testdisk.

Prerequisites

  • Ubuntu Live USB or Linux system
  • Failing SD card (avoid using it on Windows — may cause more damage)
  • External drive or enough disk space to store recovery image
  • Stable power supply (UPS recommended for long rescues)

Restore WiFi on Pi 3 Model B

Problem: After flashing the latest Raspberry Pi OS or doing a dist-upgrade, the WiFi interface (wlan0) disappears and no WiFi hardware is detected.

Solution

  1. Edit the boot configuration file:

Open /boot/config.txt in a text editor:

@0x48piraj
0x48piraj / esp32WiFi.ino
Created May 22, 2025 12:29
Artefact from 14 ‎January ‎2024, ‏‎21:04:05.
#include <WiFi.h>
const char* ssid = "ssid";
const char* password = "password";
int btnGPIO = 0;
int btnState = false;
void setup()
{
@0x48piraj
0x48piraj / GIFImageView.swift
Created May 12, 2025 17:12
Rudimentary GIF renderer
import SwiftUI
import UIKit
struct GIFImageView: UIViewRepresentable {
let gifName: String
func makeUIView(context: Context) -> UIImageView {
let imageView = UIImageView()
@0x48piraj
0x48piraj / run.sh
Created May 9, 2025 10:57
Nuke reflogs
git reflog expire --expire=now --all
git gc --prune=now --aggressive
@0x48piraj
0x48piraj / README.md
Created May 4, 2025 03:37
Clearing UserDefaults during debug builds from Xcode

Use a UUID marker on each build (works even if build number doesn't change)

If you want UserDefaults to clear every time you install a new Debug build via Xcode, regardless of version or build number, you can inject a unique marker that changes on every build.

🔧 1. In your Build Settings (not Info.plist), add a custom build variable:

Go to:

Build SettingsUser-Defined → click +

@0x48piraj
0x48piraj / .bash_profile
Created April 11, 2025 05:22
Configuring Windows GitHub SSH agent
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_ed25519
@0x48piraj
0x48piraj / BLEScan.ino
Created April 9, 2025 20:52
Continuously scans for nearby BLE devices, identifies the one with the strongest signal, attempts to connect to it, provides feedback on the connection status via the serial monitor.
#include <BLEDevice.h>
#include <BLEScan.h>
#include <BLEAdvertisedDevice.h>
BLEScan* pBLEScan;
int scanTime = 5; // Scan for 5 seconds
BLEAdvertisedDevice* closestDevice = NULL;
/*
-30 to -50 dBm: The device is very close (a few centimeters).
-50 to -70 dBm: The device is relatively close (a few meters).