Skip to content

Instantly share code, notes, and snippets.

View davidfoster's full-sized avatar

David Foster davidfoster

View GitHub Profile
@nelsnelson
nelsnelson / latency.markdown
Created October 25, 2012 22:07 — forked from hellerbarde/latency.markdown
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             
Syscall on Intel 5150 ...................... 105 ns
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Context switch on Intel 5150 ............. 4,300 ns  =   4 µs

Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs

@treefortress
treefortress / LargeTexturePackerPolicy.cs
Created January 4, 2016 18:05
SpritePacker policy for Unity to allow 4K texture atlases.
using UnityEngine;
using System;
using System.Linq;
using UnityEditor;
using System.Collections.Generic;
public class LargeTexturePackerPolicy : UnityEditor.Sprites.IPackerPolicy
{
protected class Entry
@rhettre
rhettre / CBAT_limit_orders.py
Last active March 3, 2024 15:32
Place limit orders on Coinbase Advanced Trader for just below/above the spot price for your buys/sells. Executable and automatable in AWS
import http.client
import hmac
import hashlib
import json
import time
import base64
import uuid
from enum import Enum
import math
@pasotee
pasotee / Unreal Engine - Extend main toolbar
Last active February 2, 2023 20:17
Snippet to add your own actions inside Unreal's main toolbar
void FYourModuleModule::StartupModule()
{
UToolMenu* MainTabFileMenu = UToolMenus::Get()->RegisterMenu("MainFrame.MainTabMenu.File", "MainFrame.MainMenu.File");
FToolMenuSection& Section = MainTabFileMenu->AddSection("MySection", INVTEXT("My Section Name"));
Section.AddMenuEntry(
FName("MyAction"),
INVTEXT("My Action Name"),
INVTEXT("My Action Tooltip"),
FSlateIcon(FName("OutputLogStyle"), "Log.TabIcon"),
FUIAction(FExecuteAction::CreateLambda(