Skip to content

Instantly share code, notes, and snippets.

@jamesbar2
jamesbar2 / postal-codes.json
Last active May 13, 2025 10:48 — forked from matthewbednarski/postal-codes.json
Global postal codes regex formats
[{
"Note": "The first two digits (ranging from 10–43) correspond to the province, while the last two digits correspond either to the city/delivery zone (range 01–50) or to the district/delivery zone (range 51–99). Afghanistan Postal code lookup",
"Country": "Afghanistan",
"ISO": "AF",
"Format": "NNNN",
"Regex": "^\\d{4}$"
}, {
"Note": "With Finland, first two numbers are 22.",
"Country": "Åland Islands",
"ISO": "AX",
@Richard-Major
Richard-Major / hx711.py
Last active February 20, 2023 01:05 — forked from underdoeg/hx711.py
Python port for RaspberryPI of the HX711 Breakout Board
#!/usr/bin/python3
# Development for reading sparkfun HX711 load cell amp
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
class HX711:
def __init__(self, dout, pd_sck, gain=128, readBits=24):
self.PD_SCK = pd_sck
self.DOUT = dout
@manasthakur
manasthakur / plugins.md
Last active January 17, 2025 13:17
Managing plugins in Vim

Managing plugins in Vim: The basics

Let's say the plugin is at a GitHub URL https://github.com/manasthakur/foo. First get the plugin by either cloning it (git clone https://github.com/manasthakur.foo.git) or simply downloading it as a zip (from its GitHub page).

Adding a plugin in Vim is equivalent to adding the plugin's code properly into its runtimepath (includes the $HOME/.vim directory by default). For example, if the layout of a plugin foo is as follows:

foo/autoload/foo.vim
foo/plugin/foo.vim
@mort3za
mort3za / git-auto-sign-commits.sh
Last active February 5, 2025 18:58
Auto sign your git commits
# Generate a new pgp key: (better to use gpg2 instead of gpg in all below commands)
gpg --gen-key
# maybe you need some random work in your OS to generate a key. so run this command: `find ./* /home/username -type d | xargs grep some_random_string > /dev/null`
# check current keys:
gpg --list-secret-keys --keyid-format LONG
# See your gpg public key:
gpg --armor --export YOUR_KEY_ID
# YOUR_KEY_ID is the hash in front of `sec` in previous command. (for example sec 4096R/234FAA343232333 => key id is: 234FAA343232333)
@sahara-ooga
sahara-ooga / HaveXcode9RenderMarkdown.md
Created November 26, 2017 09:18
Have Xcode 9 render markdown

Have Xcode 9 render markdown

To make Xcode 9 render markdown file eg. README.md, drop .xcodesamplecode.plist in your .xcodeproj/ folder. .xcodesamplecode.plist is like this:

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <array/> </plist>

For convenience, There is this tool, which is derived from a tutorial.

@toddway
toddway / aChecklistForReviewingCode.md
Last active October 7, 2020 15:50
A checklist for reviewing code

A checklist for reviewing code

Integration

  • Will merging this code create source conflicts?
  • Is there a clear and concise description of the changes?
  • Did all automated checks (build, test, lint) run and pass?
  • Are there supporting metrics or reports (e.g. test coverage, fitness functions) that measure the impact?
  • Are there obvious logic errors or incorrect behaviors that might break the software?

Readability

guard let query = arView.makeRaycastQuery(from: arView.center, allowing: .existingPlaneInfinite, alignment: .horizontal) else { return }
guard let raycastResult = arView.session.raycast(query).first else { return }
// set a transform to an existing entity
let transform = Transform(matrix: raycastResult.worldTransform)
entity.transform = transform
// or anchor an entity to an ARRaycastResult
let anchor = AnchorEntity(raycastResult: raycastResult)
anchor.addChild(entity)
import UIKit
import SceneKit
import ARKit
class ViewController: UIViewController, ARSCNViewDelegate {
@IBOutlet var sceneView: ARSCNView!
var anchorCount = 0
@joemasilotti
joemasilotti / Multiple sheets in SwiftUI.md
Last active October 13, 2021 03:20
Multiple sheets in SwiftUI
@mbierman
mbierman / updatedocker.sh
Last active December 24, 2024 22:49
Update Docker containers on Fireawlla
#!/bin/bash
# version 3.2.0
# https://gist.github.com/mbierman/6cf22430ca0c2ddb699ac8780ef281ef
wait=1
container=$1
DOCKER=$(which docker)
# Check if Docker is installed