Skip to content

Instantly share code, notes, and snippets.

@warwickchapman
warwickchapman / dynDns.rsc
Last active April 10, 2025 17:22
Mikrotik RouterOS 7 Cloudflare DNS Record Update
# Prerequisites
# - A Cloudflare account and a domain managed by Cloudflare.
# - The Zone ID of your domain in Cloudflare. You can find this in the Cloudflare dashboard under your domain's overview tab.
# - An API token with permissions to edit DNS records. You can create this in the Cloudflare dashboard under "My Profile" > "API Tokens".
# Creating an API Token in Cloudflare
# - Go to Cloudflare Dashboard > My Profile > API Tokens.
# - Click "Create Token".
# - Use the "Edit zone DNS" template.
# - Set permissions for the specific zone (domain) you wish to update via DDNS.
@bashtheshell
bashtheshell / rpi-imager-cli_macOS_tutorial.md
Last active March 12, 2025 16:51
Brief tutorial on how to use Raspberry Pi Imager `rpi-imager --cli` command on macOS to be able to automate image re-creation.

How to Use Raspberry Pi's rpi-imager --cli Command on macOS

With the modern rpi-imager tool, we can automate the imaging process for the Raspberry Pi computer board and make the process extremely painless for us each time we need to re-image.

The official Raspberry Pi's rpi-imager's tool (which can be installed from https://www.raspberrypi.com/software/) contains a command-line option that's not widely documented anywhere at the time of this writing (v1.7.5 was the latest release).

The best official documentation I can possibly find on Raspberry Pi Imager did not cover the command-line option.

As a result, I'll only cover the command-line option for macOS here as it's my daily driver.

@rmorse
rmorse / react-router-dom-v.6.02.prompt.blocker.js
Last active November 13, 2024 16:02
Adds back in `useBlocker` and `usePrompt` to `react-router-dom` version 6.0.2 (they removed after the 6.0.0 beta, temporarily)
/**
* These hooks re-implement the now removed useBlocker and usePrompt hooks in 'react-router-dom'.
* Thanks for the idea @piecyk https://github.com/remix-run/react-router/issues/8139#issuecomment-953816315
* Source: https://github.com/remix-run/react-router/commit/256cad70d3fd4500b1abcfea66f3ee622fb90874#diff-b60f1a2d4276b2a605c05e19816634111de2e8a4186fe9dd7de8e344b65ed4d3L344-L381
*/
import { useContext, useEffect, useCallback } from 'react';
import { UNSAFE_NavigationContext as NavigationContext } from 'react-router-dom';
/**
* Blocks all navigation attempts. This is useful for preventing the page from
* changing until some condition is met, like saving form data.
@V8tr
V8tr / AutoLayoutDSL.swift
Last active March 23, 2025 19:10
Auto Layout DSL
import UIKit
/// Represents a single `NSLayoutConstraint`
enum LayoutAnchor {
case constant(attribute: NSLayoutConstraint.Attribute,
relation: NSLayoutConstraint.Relation,
constant: CGFloat)
case relative(attribute: NSLayoutConstraint.Attribute,
relation: NSLayoutConstraint.Relation,
@vovkasm
vovkasm / KeyboardAvoidingView.tsx
Created November 30, 2018 05:47
Sample of custom analog of KeyboardAvoidingView in "padding" mode, that actually works.
import React from 'react'
import {
EmitterSubscription,
Keyboard,
LayoutAnimation,
LayoutChangeEvent,
LayoutRectangle,
Platform,
StyleSheet,
View,
@jordanmkoncz
jordanmkoncz / .react-navigation iOS 11 Navigation Bar with Large Title
Last active March 10, 2025 15:57
react-navigation iOS 11 Navigation Bar with Large Title
#
@spacepatcher
spacepatcher / Breach Compilation (1.4 billion credentials) in Postgres.md
Last active April 8, 2025 15:34
Breach Compilation (1.4 billion credentials) in Postgres.md
// gets uid 0 (iOS 11)
// add patchfinder and you should be good
// Abraham Masri @cheesecakeufo
/*
* Purpose: iterates over the procs and finds our proc
*/
uint64_t get_our_proc() {
{"contents":{"editor":{"formatOnSave":true}},"overrides":[],"keys":["editor.formatOnSave"]}
@artemch
artemch / strip-frameworks.sh
Last active September 25, 2020 05:37
iOS framework binaries must be stripped off back from simulator slices. This is copy of [strip-frameworks.sh](https://github.com/realm/realm-cocoa/blob/d59c86f11525f346c8e8db277fdbf2d9ff990d98/scripts/strip-frameworks.sh)
################################################################################
#
# Copyright 2015 Realm Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#