Skip to content

Instantly share code, notes, and snippets.

View novelistparty's full-sized avatar

novelistparty novelistparty

View GitHub Profile
#define BINKGL_LIST \
/* ret, name, params */ \
GLE(void, LinkProgram, GLuint program) \
GLE(void, GetProgramiv, GLuint program, GLenum pname, GLint *params) \
GLE(GLuint, CreateShader, GLenum type) \
GLE(void, ShaderSource, GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length) \
GLE(void, CompileShader, GLuint shader) \
GLE(void, GetShaderiv, GLuint shader, GLenum pname, GLint *params) \
GLE(void, GetShaderInfoLog, GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog) \
GLE(void, DeleteShader, GLuint shader) \
OpenSimplexNoise noise;
int[][] result;
float t, c;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
float ease(float p, float g) {
@MonsieurV
MonsieurV / createImageBitmap.js
Last active February 16, 2021 11:04
createImageBitmap polyfill with Blob and ImageData source support
/*
* Safari and Edge polyfill for createImageBitmap
* https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap
*
* Support source image types Blob and ImageData.
*
* From: https://dev.to/nektro/createimagebitmap-polyfill-for-safari-and-edge-228
* Updated by Yoan Tournade <[email protected]>
*/
if (!('createImageBitmap' in window)) {
@jemmons
jemmons / Create Input with Block.swift
Last active November 17, 2022 07:04
Sample CoreMIDI code…
// See: https://forums.developer.apple.com/thread/65997
MIDIInputPortCreateWithBlock(midiClient, "Instrument" as CFString, &inPort, {
(unsafePacketList: UnsafePointer<MIDIPacketList>, pointer: UnsafeMutableRawPointer?) in
let packetList = unsafePacketList.pointee
if packetList.numPackets == 1 {
let packet = packetList.packet
if packet.length == 3 && packet.data.0 == 144 {
/* Note-On */
let note = packet.data.1
@rlcamp
rlcamp / coroutine.c
Last active March 4, 2022 22:53
Coroutines for generator functions, sequential pipelines, state machines, and other uses in C
see https://github.com/rlcamp/coroutine
@mmalex
mmalex / allpasstest.cpp
Created March 4, 2020 14:55
quick timing test of different ways of writing a chain of serial allpasses
#include "stdafx.h"
#include <Windows.h> // for performance counter
// quick test of the theory in https://gist.github.com/mmalex/3a538aaba60f0ca21eac868269525452
// we try running a simple impulse train (click every 4096 samples) through 6 allpasses with random lengths
// we time how long it takes to process 1 million samples, structuring the loop 3 ways:
// - a sample at a time with self contained allpass structures,
// - a sample at a time with a single big buffer
// - a block at a time using self contained allpass structures, operating in place on a 256 sample buffer.
// using this naive code, on a single core of my AMD threadripper, with default release compile settings on visual studio 2015,
// I see
@katef
katef / life-utf8.c
Last active September 8, 2024 05:59
XBM to UTF-8 braille image things
/*
* John Conway's Game of Life.
*
* This is written for POSIX, using Curses. Resizing of the terminal is not
* supported.
*
* By convention in this program, x is the horizontal coordinate and y is
* vertical. There correspond to the width and height respectively.
* The current generation number is illustrated when show_generation is set.
*

Getting started developing/debugging on embedded STM32 ARM microcontrollers with Visual Studio Code on Windows

Straight to the point

If you're only interested in the setup process, skip to Step 1 below and ignore my rantings.

Background

I spent a lot of time over the past few years with embedded projects in various IDE's from different silicon companies, all based on Eclipse, and all equally painful and horrible to use. Eclipse is an ancient and stagnant platform, filled with bugs, lacking many features some would consider mandatory in a modern IDE. The process of writing code in Eclipse drains every drop of joy out of the process, like muddy water squeezed out of a wet rag.

I couldn't take it anymore. Something had to change. If I couldn't have code completion, fast intelligent code navigation or even a working visual debugger, why even use an IDE in the first place?

@rlcamp
rlcamp / configure
Last active October 7, 2024 15:41
#!/usr/bin/env bash
# richard campbell
# isc license
#
# assumptions/caveats:
# - this script is run by bash 3.2+, produces a Makefile suitable for gnu make 3.81+
# - targets to build have a main function in a .c file of the same name
# - each module depended upon is in the same directory
# - each module depended upon consists of one .c and one .h file
# - if you need to link in external libraries, you still need to manually provide those to make via LDLIBS