Skip to content

Instantly share code, notes, and snippets.

View btipling's full-sized avatar
:shipit:
shipping code

Bjorn btipling

:shipit:
shipping code
  • ConductorOne
  • Bay Area, California
  • 08:32 (UTC -08:00)
View GitHub Profile
@deccer
deccer / troubleshoot.gl.md
Last active October 19, 2024 12:43
Troubleshoot - OpenGL

i was wondering if we should/could list common errors in the gl get started thing too, after debugcallback/renderdoc chapters or probably in some appendix, if you have more of those, let me know then we can compile those together into some comprehensive unfuck gl list

  • you use glad and its giving you a hard time, symbols not found, multiple definitions etc

    • you most likely did just generate the headers on dav1d's site and manually downloaded the zip and all that bs some time ago
    • if you cant be bothered to use cmake and let cmake handle all that for you, check the timestamp when you generated it last time, and if its (most likely) old, regenerate it again, will most likely fix it
    • use cmake to fetch glad and it will handle gl header generation
  • nothing works:

    • get rid of GLCALL/GLCHECK macros, most of them use glGetError incorrectly anyway
  • setup glDebugMessageCallback see here

@buroz
buroz / main.go
Last active March 2, 2025 20:32
Golang SOAP Request Example
package main
import (
"bytes"
"crypto/tls"
"encoding/xml"
"fmt"
"io/ioutil"
"net/http"
"strings"
@btipling
btipling / alignbuffer.swift
Last active October 10, 2019 23:21
Keep your MTLBuffer struct buffer size aligned with this easy to use function
/*
* `bufferSize` is the total size of your buffer when adding up the sizes of your struct's properties (not alignments)
* `alignment` is the largest alignment for your struct. That is one of your struct's properties will have the largest
* alignment value out of all the alignment values for each of your structs properties. Use that value for the second
* argument.
*
* To see the alignment of types see here: https://developer.apple.com/library/ios/documentation/Metal/Reference/MetalShadingLanguageGuide/data-types/data-types.html#//apple_ref/doc/uid/TP40014364-CH2-SW15
*
* Example:
@btipling
btipling / libPNGOpenGL.cpp
Created May 3, 2016 04:19 — forked from mortennobel/ libPNGOpenGL.cpp
Updated to libpng 1.5.15
#ifdef _WIN32
#include <GL/glut.h>
#else
#include <GLUT/glut.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <png.h>
#include <iostream>
@paulirish
paulirish / what-forces-layout.md
Last active March 1, 2025 05:48
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
@ggreer
ggreer / birth_month.py
Created January 26, 2015 18:30
Pypy is *fast*
#!/usr/bin/env python
import random
matches = 0
total = 1000000
people = 5
for i in range(total):
month = random.randrange(12)
for j in reversed(range(people - 1)):
@tarruda
tarruda / keybase.md
Created September 16, 2014 10:01
keybase.md

Keybase proof

I hereby claim:

  • I am tarruda on github.
  • I am tarruda (https://keybase.io/tarruda) on keybase.
  • I have a public key whose fingerprint is 5A71 6962 941B 684F 539E 6CD0 BEC2 61F3 78B2 8824

To claim this, I am signing this object:

@tarruda
tarruda / snake.py
Last active June 11, 2021 00:01
snake.py
# Snake for Neovim! Adapted from https://gist.github.com/sanchitgangwar/2158084
# To install, create a ~/.vim/rplugin/python/snake.py file with this
# code, then run `nvim -c 'UpdateRemotePlugins' -c 'q'` from a shell.
#
# Make sure you have read the internal help explaining how to setup python
# host for external plugins(:help nvim-python)
#
# To start a new game, use the `:SnakeStart` command on an empty buffer(uses 80
# columns and 20 rows)
from threading import Thread, Lock
@staltz
staltz / introrx.md
Last active March 3, 2025 08:27
The introduction to Reactive Programming you've been missing
@mathieulegrand
mathieulegrand / connect.rs
Last active March 10, 2018 19:57
simple connect to server:443 in Rust
// Rust 0.10-pre (Tue Mar 18, 2014)
// $ rustc -L rust-openssl/build/ -L rust-toml/lib doing.rs
// assuming https://github.com/sfackler/rust-openssl is cloned and compiled,
// and https://github.com/mneumann/rust-tom is cloned and compiled
#[feature(macro_rules)];
#[allow(deprecated_owned_vector)];
extern crate openssl;
extern crate serialize;