Skip to content

Instantly share code, notes, and snippets.

@skeeto
skeeto / testenv.cpp
Created September 30, 2024 23:22
Quick test of environment variable passing
// Quick test of environment variable passing
// $ cc -nostartfiles -o testenv testenv.cpp
// $ cl testenv.cpp /link /subsystem:console kernel32.lib
//
// Spawns a copy of itself with a custom-built environment block, and
// the spawned child examines/probes that block.
//
// This is free and unencumbered software released into the public domain.
typedef int I;
@Dani-0TB
Dani-0TB / MSYS2_UCRT_SDL2_VSCODE_CONFIG.md
Last active May 28, 2025 09:53
Setting up SDL2 for development on Windows with MSYS2 and VS Code

Setting up SDL2 for development on Windows with MSYS2 and VS Code

Hello! I made this document for anyone trying to setup an enviroment for SDL2 on Windows using VS Code for building and debugging.

This is just a basic setup to test everything works and compiles correctly. This is adapted from this guide by Adam Richardson, made to work with the UCRT enviroment.

So, let's get to it.

Download and install MSYS2 64bit

@Alexufo
Alexufo / simple-https-python-server.py
Last active July 31, 2025 14:13
Simple Python https server example py 3.10+ ( multithread, wasm, gzip )
import http.server
import http.cookiejar
import io
import socket
from http import HTTPStatus
import ssl
import os
import zlib
server_address = ('0.0.0.0', 4443)
#!/usr/bin/env python3
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import http.server
@xaratustrah
xaratustrah / simple-https-server.py
Last active August 27, 2018 12:04 — forked from dergachev/simple-https-server.py
simple-https-server.py
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
# Changed for python 3
import http.server
@rudolfovich
rudolfovich / csvfile.h
Last active March 30, 2025 18:07
CSV file generator
#pragma once
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
class csvfile;
inline static csvfile& endrow(csvfile& file);
inline static csvfile& flush(csvfile& file);
@evanwill
evanwill / gitBash_windows.md
Last active August 6, 2025 09:33
how to add more utilities to git bash for windows, wget, make

How to add more to Git Bash on Windows

Git for Windows comes bundled with the "Git Bash" terminal which is incredibly handy for unix-like commands on a windows machine. It is missing a few standard linux utilities, but it is easy to add ones that have a windows binary available.

The basic idea is that C:\Program Files\Git\mingw64\ is your / directory according to Git Bash (note: depending on how you installed it, the directory might be different. from the start menu, right click on the Git Bash icon and open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git, the mingw64 in this directory is your root. Find it by using pwd -W). If you go to that directory, you will find the typical linux root folder structure (bin, etc, lib and so on).

If you are missing a utility, such as wget, track down a binary for windows and copy the files to the corresponding directories. Sometimes the windows binary have funny prefixes, so

@ChiChou
ChiChou / unhex.sql
Last active July 31, 2025 13:52
SQLite3 convert hex string to int (requires sqlite >= 3.8.3)
WITH RECURSIVE
unhex(str, val, weight) AS (
SELECT 'deadbeef', 0, 1
UNION ALL
SELECT
substr(str, 1, length(str) - 1),
val + (instr('0123456789ABCDEF', substr(str, length(str), 1)) - 1) * weight,
weight * 16
FROM unhex WHERE length(str) > 0
)
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
@ohsqueezy
ohsqueezy / pygame-play-tone.py
Last active March 14, 2022 09:46
Play a 440 Hz tone in Pygame
# Generate a 440 Hz square waveform in Pygame by building an array of samples and play
# it for 5 seconds. Change the hard-coded 440 to another value to generate a different
# pitch.
#
# Run with the following command:
# python pygame-play-tone.py
from array import array
from time import sleep