Skip to content

Instantly share code, notes, and snippets.

@deccer
deccer / troubleshoot.gl.md
Last active March 26, 2025 01:55
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"
@paulirish
paulirish / what-forces-layout.md
Last active May 8, 2025 05:49
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 May 9, 2025 12:50
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;
@Madsy
Madsy / gist:6980061
Last active March 26, 2025 01:55
Working multi-threading two-context OpenGL example with GLFW 3.0.3 and GLEW 1.8
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <vector>
#include <cmath>
#include <cstdio>
#include <limits>
#include <chrono>
#include <thread>
#include <mutex>
@jasonrudolph
jasonrudolph / 00-about-search-api-examples.md
Last active January 3, 2025 03:54
5 entertaining things you can find with the GitHub Search API