Skip to content

Instantly share code, notes, and snippets.

View NathanFlurry's full-sized avatar
🔩
Riveting

Nathan Flurry NathanFlurry

🔩
Riveting
View GitHub Profile
@RealOrangeOne
RealOrangeOne / README.md
Last active February 23, 2024 11:27
Trello JSON parser

Trello Parser

Download

Open a terminal, run this:

sudo curl https://gist.githubusercontent.com/RealOrangeOne/c35751ee794e90df512bdfba6f22574d/raw/trello-parser.py -o /usr/bin/trelloparse && sudo chmod +x /usr/bin/trelloparse

Usage

$ trelloparse -h

usage: tp [-h] input output

@AndrewRayCode
AndrewRayCode / example-bake.py
Created July 6, 2016 19:45
Blender Python script to bake in an ambient occlusion map offline
import bpy
ops = bpy.ops
scene = bpy.context.scene
mesh = bpy.ops.mesh
# Delete default scene objects
ops.object.select_all()
ops.object.select_all()
ops.object.delete()
@lanephillips
lanephillips / CGRectAspectFit.m
Created October 7, 2013 21:05
Objective-C code to fit a CGRect inside or outside another CGRect while maintaining aspect ratio. The fitted rectangle is centered on the target rectangle.
CGFloat ScaleToAspectFitRectInRect(CGRect rfit, CGRect rtarget)
{
// first try to match width
CGFloat s = CGRectGetWidth(rtarget) / CGRectGetWidth(rfit);
// if we scale the height to make the widths equal, does it still fit?
if (CGRectGetHeight(rfit) * s <= CGRectGetHeight(rtarget)) {
return s;
}
// no, match height instead
return CGRectGetHeight(rtarget) / CGRectGetHeight(rfit);
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@AlliedEnvy
AlliedEnvy / delaunay.lua
Created June 5, 2011 23:04
Delaunay Triangulation and Relative Network Graph
--[[
Delaunay Triangulation Code, by Joshua Bell
http://www.travellermap.com/tmp/delaunay.js
Ported to Lua by Daniel Levy
Inspired by: http:www.codeguru.com/cpp/data/mfc_database/misc/article.php/c8901/
This work is hereby released into the Public Domain. To view a copy of the public
domain dedication, visit http:creativecommons.org/licenses/publicdomain/ or send
a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco,