Skip to content

Instantly share code, notes, and snippets.

View micampe's full-sized avatar

Michele Campeotto micampe

View GitHub Profile
@jszym
jszym / namespaced_token.py
Created June 28, 2023 17:57
Namespaced, random token.
from base64 import urlsafe_b64encode
from blake3 import blake3
import krock32
from time import time
import secrets
import math
def generate_token(namespace: str) -> str:
"""
@kconner
kconner / macOS Internals.md
Last active April 22, 2024 21:28
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

  SN32F268 ATmega32U4 AT90USB1286 Proton C - STM32F303xC Blackpill - STM32F411 Nice Nano (nRF52840) RP2040
Speed 48MHz 16MHz 16MHz 72MHz ~96MHz 64MHz 2@ 133MHz
Voltage 3.3V 5V 5V 3.3V with some 5V capable pins 3.3V with 5V capable pins 3.3v 3.3v
Flash size 32kB (~28kB usable) 32kB (28kB usable) 128kB (120kB usable) 256kB 512kB 1MB off-chip flash, up to 16MB
EEPROM si
@gdavis
gdavis / xcode-vim.markdown
Last active April 12, 2024 13:41
Notes for working with Xcode VIM mode

Xcode VIM

Learning VIM in Xcode comes with its own set of challenges and limitations, but there is enough there for you to give your mousing hand a break and master the keyboard.

A limited set of commands are available in Xcode, and this document attempts help ease the learning curve of using VIM in Xcode by providing a handy reference as well as what I find works for me in practice.

NOTE: Commands are case-sensitive. A command of N means pressing shift + n on the keyboard.

This document is a work in progress! Leave a comment if you would like to see a change.

@sirikon
sirikon / task.py
Last active July 25, 2023 12:09
Task file in Python 3
#!/usr/bin/env python3
def cli():
@command
def hello(*args):
cmd('echo', 'Hello', *args)
@khaledhosny
khaledhosny / cldr-coverage.py
Last active May 8, 2020 15:49
Calculate font script and language coverage based on ICU exemplar data
# Copyright 2020 Khaled Hosny
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
//
// Deduplicated.swift
// CountriesSwiftUI
//
// Created by Alexey Naumov on 17.12.2019.
// Copyright © 2019 Alexey Naumov. All rights reserved.
//
import Foundation
import Combine
@romainl
romainl / Vim_pushing_built-in_features_beyond_their_limits.markdown
Last active September 19, 2023 08:16
Vim: pushing built-in features beyond their limits

Vim: pushing built-in features beyond their limits

The situation

Searching can be an efficient way to navigate the current buffer.

The first search commands we learn are usually / and ?. These are seriously cool, especially with the incsearch option enabled which lets us keep typing to refine our search pattern. / and ? really shine when all we want is to jump to something we already have our eyeballs on but they are not fit for every situation:

  • when we want to search something that's not directly there, those two commands can make us lose context very quickly,
  • when we need to compare the matches.