Skip to content

Instantly share code, notes, and snippets.

@naps62
naps62 / translate.sh
Last active July 20, 2026 08:54
post-processing script for translating subtitles to target lang after english download
#!/usr/bin/env bash
#
# Bazarr custom post-processing: translate a just-downloaded subtitle to a
# target language. Backend is chosen by which env var is set (precedence):
#
# LLAMA_URL set -> local LLM via llama.cpp / any OpenAI-compatible server
# (best quality; parses the .srt and translates cue-by-cue)
# DEEPL_API_KEY set -> DeepL document API
# otherwise -> Bazarr's own translate API (Google)
#
@naps62
naps62 / Camera.tsx
Last active May 3, 2026 20:30
Custom react view for a home assistant Webrtc camera
import { Loader2 } from "lucide-react";
import {
createContext,
type ReactNode,
useContext,
useEffect,
useMemo,
useRef,
useState,
} from "react";
@naps62
naps62 / naps62-Ergodox---Media-Layer.kbd.json
Last active February 6, 2025 15:27
naps62 Ergodox - Media Layer
[
{
"backcolor": "#333333",
"name": "naps62 Ergodox - Media Layer",
"author": "Miguel Palhas <miguel@subvisual.co>",
"radii": "20px",
"switchMount": "cherry",
"switchBrand": "cherry",
"switchType": "MX1A-G1xx",
"pcb": false,
@naps62
naps62 / naps62-Ergodox---Coder-Layer.kbd.json
Last active February 6, 2025 15:27
naps62 Ergodox - Coder Layer
[
{
"backcolor": "#333333",
"name": "naps62 Ergodox - Coder Layer",
"author": "Miguel Palhas <miguel@subvisual.co>",
"radii": "20px",
"switchMount": "cherry",
"switchBrand": "cherry",
"switchType": "MX1A-G1xx",
"pcb": false,
@naps62
naps62 / naps62-Ergodox---Base-Layer.kbd.json
Last active February 6, 2025 15:27
naps62 Ergodox - Base Layer
[
{
"backcolor": "#333333",
"name": "naps62 Ergodox - Base Layer",
"author": "Miguel Palhas <miguel@subvisual.co>",
"radii": "20px",
"switchMount": "cherry",
"switchBrand": "cherry",
"switchType": "MX1A-G1xx",
"pcb": false,
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
import "openzeppelin-contracts/contracts/utils/math/Math.sol";
import "src/Interfaces/IBorrowerOperations.sol";
import {DECIMAL_PRECISION} from "src/Dependencies/Constants.sol";
import "src/Zappers/Modules/Exchanges/UniswapV3/IUniswapV3Pool.sol";
import "src/Zappers/Modules/Exchanges/UniswapV3/INonfungiblePositionManager.sol";
@naps62
naps62 / ethui-v2.md
Last active October 25, 2024 11:14
ethui v2

ethui v2 (formerly Iron wallet)

overall goal: unified setup for building, testing and deploying web3 apps, both smart contracts & web app

ethui app (wallet)

  • lots of improvements to be made, but the main core is good enough to build on top of (famous last words, I know)
  • I truly believe we offer some ideas that are not present in any other developer tool
  • some ideas can absolutely be adapted for end-users (i.e. to provide power-user features, robustness, and a good trade-off between UX and security)
#!/usr/bin/env bash
function check_root() {
id -u
ps -o comm= -p $PPID
if [[ "$(id -u)" -ne 0 || $(ps -o comm= -p $PPID) == "sudo" ]]; then
echo -e "\nExiting..."
exit
fi
}
echo "asd"
@naps62
naps62 / Diva Airdrop Claim.md
Created July 3, 2023 09:59
Diva Airdrop Claim

Claiming the airdrop for Diva

@naps62
naps62 / swap.sol
Created November 11, 2022 19:42
UniswapV3: Swap USDT->WETH->RPL
pragma solidity ^0.8.13;
import "forge-std/Script.sol";
interface UniV3 {
struct ExactInputParams {
bytes path;
address recipient;
uint256 amountIn;
uint256 amountOutMinimum;