Skip to content

Instantly share code, notes, and snippets.

@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.
@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")

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
@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")
@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
#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) \
@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
/*
I'm dropping this from the game in favour of a more dynamic system, but I wanted to keep this around somewhere because
I'll be using this 'pattern' for something similar again and didn't want to fuss with sytax. Maybe you'll find it useful
*/
#define ANIM_LIST \
/* EnumName, var_name, max */ \
ALF(Invalid, invalid, 1) \
ALF(Idle, idle, 4) \
ALF(Spawn, spawn, 4) \
ALF(Taunt, taunt, 2) \
@vurtun
vurtun / Library writing.txt
Created September 12, 2016 11:20
Library writing
LIBRARY WRITING REFERENCE LIST
===============================
1.) Designing and Evaluating Reusable Components (Casey Muratori: http://mollyrocket.com/casey/stream_0028.html)
----------------------------------------------------------------------------------------------------------------
_THE_ reference on API design up to this day on the internet. Nobody should write a library without having seen this.
I come back to this talk every N number of weeks it is that good.
2.) stb_howto (Sean Barrett: https://github.com/nothings/stb/blob/master/docs/stb_howto.txt)
--------------------------------------------------------------------------------------------
Sean Barretts single header libraries (https://github.com/nothings/stb) was the first time for me that I came across
@HardenedArray
HardenedArray / Efficient Encrypted UEFI-Booting Arch Installation
Last active March 18, 2025 17:50
An effcient method to install Arch Linux with encrypted root and swap filesystems and boot from UEFI. Multi-OS, and VirtualBox, UEFI-booting are also supported.
# OBJECTIVE: Install Arch Linux with encrypted root and swap filesystems and boot from UEFI.
# Note this encrypted installation method, while perfectly correct and highly secure, CANNOT support encrypted /boot and
# also CANNOT be subsequently converted to support an encrypted /boot!!! A CLEAN INSTALL will be required!
# Therefore, if you want to have an encrypted /boot or will want an encrypted /boot system at some point in the future,
# please ONLY follow my encrypted /boot installation guide, which lives here: