Skip to content

Instantly share code, notes, and snippets.

@mmozeiko
mmozeiko / dxgl.c
Last active June 9, 2025 11:26
WGL_NV_DX_interop2 example
#define COBJMACROS
#define INITGUID
#include <intrin.h>
#include <windows.h>
#include <d3d11.h>
#include <gl/GL.h>
#include "glext.h" // https://www.opengl.org/registry/api/GL/glext.h
#include "wglext.h" // https://www.opengl.org/registry/api/GL/wglext.h
#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) \
@pervognsen
pervognsen / mu.cpp
Last active May 18, 2025 16:15
Mu as of the second stream
#include "mu.h"
#define _CRT_SECURE_NO_WARNINGS
#include <malloc.h>
#define _USE_MATH_DEFINES
#include <math.h>
#define _NO_CRT_STDIO_INLINE
#include <stdio.h>
#include <stdarg.h>
#define NO_STRICT
@mesbahamin
mesbahamin / listdictsearch.py
Last active May 23, 2016 23:11
Searching a dict and ensuring either zero or one results.
# This is a simplified version of a more complex problem I'm trying to solve.
# search() seems to have the desired behavior (see docstring), but seems a bit clumsy.
# Is there a more pythonic way to do this?
def search(my_list, my_dict, search_term):
"""Example Output:
---
>>> l = [1, 2, 3, 4]
>>> d = {1: "foo", 2: "bar", 3: "baz", 4: "baz"}
>>> search(l, d, "borkborkbork")
anonymous
anonymous / prime_conspiracy.py
Created March 15, 2016 06:23
Demonstrate the "prime conspiracy"
'''Demonstrate the "prime number conspiracy" as described at
https://www.quantamagazine.org/20160313-mathematicians-discover-prime-conspiracy/
"Among the first billion prime numbers, for instance, a prime ending in
9 is almost 65 percent more likely to be followed by a prime ending in 1
than another prime ending in 9. In a paper posted online today, Kannan
Soundararajan and Robert Lemke Oliver of Stanford University present
both numerical and theoretical evidence that prime numbers repel other
would-be primes that end in the same digit, and have varied
predilections for being followed by primes ending in the other possibl
@rochacbruno
rochacbruno / mainpython.md
Last active July 22, 2024 19:03
Use of __main__.py

The use of __main__.py to create executables

myprojectfolder/
    |_ __main__.py
    |_ __init__.py

Being __main__.py:

print("Hello")

@AWMooreCO
AWMooreCO / AdvancedWindowSnap.ahk
Last active April 19, 2025 18:27
Advanced Window Snap is a script for AutoHotKey that expands upon Windows built-in window-snapping hotkeys.
/**
* Advanced Window Snap
* Snaps the Active Window to one of nine different window positions.
*
* @author Andrew Moore <[email protected]>
* @version 1.0
*/
/**
* SnapActiveWindow resizes and moves (snaps) the active window to a given position.
@swarminglogic
swarminglogic / vlcopen.sh
Last active December 13, 2018 22:25
Download video URL (youtube-dl supported), and automatically open with VLC as soon as possible. Assign to global hotkey for easy use: (1. Copy URL. 2. Hit hotkey shortcut. 3. Wait a few seconds. 4. Enjoy in VLC)
#!/bin/bash
if [ $# -eq 1 ] ; then
path=$1
else
clipboard=$(xclip -selection clipboard -o)
if [ $(<<<$clipboard grep -P "^http") ] ; then
path=$clipboard
else
if [ -t 1 ] ; then
@bertvv
bertvv / pandoc.Makefile
Last active November 24, 2022 08:55
Makefile for Markdown -> PDF using pandoc
# Generate PDFs from the Markdown source files
#
# In order to use this makefile, you need some tools:
# - GNU make
# - Pandoc
# - LuaLaTeX
# - DejaVu Sans fonts
# Directory containing source (Markdown) files
source := src
me:
@true
a:
@true
sandwich:
@[ "$$(id -u)" -eq 0 ] && echo "Okay." || echo "What? Make it yourself."
.PHONY: me a sandwich