Skip to content

Instantly share code, notes, and snippets.

@svpino
svpino / instructions.md
Last active July 9, 2025 17:24
Installing TensorFlow on Apple Silicon
@NotKit
NotKit / Gemini_PDA_UBPorts.md
Last active August 27, 2025 09:44
Gemini PDA - UBPorts

Running Ubuntu Touch on Gemini PDA

Installation

Use prebuild system.img and get the ubports edge rootfs from here.

Boot into TWRP and install it with the JBB's halium-install script.

./halium-install -p ut ubports-touch.rootfs-xenial-edge-armhf.tar.gz system.img
adb push halium-boot.img /tmp
@canterberry
canterberry / crypto.ec.pem.js
Created April 26, 2018 23:15
Export PEM-encoded EC key pair (ECDH, ECDSA)
// (Buffer is available in Node.js as a global, but we require it this way for compatibility)
// See: https://nodejs.org/api/buffer.html#buffer_buffer
const { Buffer } = require('buffer');
const crypto = require('crypto');
const keyPair = crypto.createECDH('secp256k1');
keyPair.generateKeys();
// Print the PEM-encoded private key
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 4, 2026 08:54
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@klgraham
klgraham / hello-luajit.c
Last active August 24, 2025 16:11
A simple example of embedding LuaJIT in C
#include <stdio.h>
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#include "luajit.h"
int main(int argc, char *argv[])
{
int status;
lua_State *L;
@bkaradzic
bkaradzic / orthodoxc++.md
Last active April 27, 2026 06:43
Orthodox C++

Orthodox C++

This article has been updated and is available here.

@paulirish
paulirish / what-forces-layout.md
Last active May 4, 2026 19:42
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@ikwattro
ikwattro / instructions.md
Last active October 21, 2020 23:58
OS X Downgrade to Ant 1.9.3
@paulmelnikow
paulmelnikow / shadows.scss
Last active August 22, 2022 15:35
Sass Mixin: Google Material Design Shadow
/**
* A mixin which helps you to add depth to elements according to the Google Material Design spec:
* http://www.google.com/design/spec/layout/layout-principles.html#layout-principles-dimensionality
*
* Please note that the values given in the specification cannot be used as is. To create the same visual experience
* the blur parameter has to be doubled.
*
* Adapted from a LESS version at https://medium.com/@Florian/freebie-google-material-design-shadow-helper-2a0501295a2d
*
* Original Author: Florian Kutschera (@gefangenimnetz), Conceptboard GmbH (@conceptboardapp)
@bnlucas
bnlucas / miller_rabin.py
Last active April 11, 2024 16:43
Miller-Rabin primality testing with Python.
def miller_rabin(n, k=10):
if n == 2:
return True
if not n & 1:
return False
def check(a, s, d, n):
x = pow(a, d, n)
if x == 1:
return True