Skip to content

Instantly share code, notes, and snippets.

@thecarlhall
thecarlhall / FreeTime.gs
Created November 6, 2023 15:49
Find how much free time (i.e., unscheduled) there is per calendar day
/*
* User Settings
*/
// Always use current week. How many weeks past that to check?
const WEEKS_AHEAD = 0;
// Assume each day starts, ends at the same times
const WORK_START_HR = 9;
const WORK_END_HR = 18;
@bitRAKE
bitRAKE / bitmap_decode_ctz.asm
Last active October 16, 2022 12:12
convert bitmask buffer to array indices
; references:
; https://branchfree.org/2018/05/22/bits-to-indexes-in-bmi2-and-avx-512/
; https://lemire.me/blog/2018/03/08/iterating-over-set-bits-quickly-simd-edition/
; http://0x80.pl/notesen/2019-01-05-avx512vbmi-remove-spaces.html
align 64
; RCX : number of quadword to convert
; RSI : source bit array
; RDI : destination index array
bitmap_decode_ctz:
jrcxz .all_zero
@lundman
lundman / time.h
Last active September 13, 2024 16:48
time.h style timers for macOS
#include <sys/stdtypes.h>
#include <stdbool.h>
#include <mach/boolean.h>
#include <sys/errno.h>
#include <stdlib.h>
#include <dispatch/dispatch.h>
#if !defined(MAC_OS_X_VERSION_10_12) || \
(MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12)
@sroccaserra
sroccaserra / Amiga_samples_conversion.md
Last active May 10, 2024 04:09
Documenting the converstion of old Amiga 8 bit samples

Archive:

These are 8 bit samples often used with the first Amiga trackers of the late 80s and early 90s, like Ultimate Soundtracker. In original and updated formats.

Following the info found in [this other archive][other], I tried to accurately convert the original files to modern & self documenting formats (.wav or .aiff), so they can easily be used in modern DAWs or modern trackers, like

@dreness
dreness / notes.md
Last active December 18, 2019 21:52
#Windows advice

Preamble

I run a fair amount of *nix software on my Windows machine - not because it's easy, but because it has become apparent that this die-hard Mac user needs a more diverse portfolio (for personal reasons; I have successfully avoided Windows for my entire career to date). In fact, it's quite difficult compared to running the same software on macOS, which isn't too surprising since macOS is generally considered to be a member of the *nix family, while Windows is not.

This document contains a random bag of things that will cut you as you attempt to cross the streams, and also the occasional tip or trick.

Condensced wisdom

  • There are many choices of 'environments' for building / running things, such as: MSYS2, Cygwin, Anaconda, VCPKG, WSL. They can be used concurrently (with important caveats; keep reading), and the correct one to use for a given task likely depends on compatability requirements of the software you're making or using.
  • path handling is a mess (WSL purports to ease this pain some
@vretro
vretro / mupen64plus.cfg
Created August 7, 2016 19:34
Working Mupen 64 Plus config for HuiJia USB GamePad adaptor when used in RetroPie
# Mupen64Plus Configuration File
# This file is automatically read and written by the Mupen64Plus Core library
[Audio-OMX]
Version = 1
OUTPUT_PORT = "1"
# Frequency which is used if rom doesn't want to change it
DEFAULT_FREQUENCY = 33600
# Swaps left and right channels
@vretro
vretro / InputAutoCfg.ini
Created August 7, 2016 19:28
HuiJia USB GamePad adaptor auto config for RetroPie (Working Multi Player)
; InputAutoCfg.ini for Mupen64Plus SDL Input plugin
; Keyboard_START
[Keyboard]
plugged = True
plugin = 2
mouse = False
DPad R = key(100)
DPad L = key(97)
DPad D = key(115)
@brendangregg
brendangregg / chaintest.py
Last active May 26, 2023 09:55
chaintest
#!/usr/bin/python
#
# chaintest Summarize off-CPU time by kernel stack + 2 waker stacks
# WORK IN PROGRESS. For Linux, uses BCC, eBPF.
#
# USAGE: chaintest [-h] [-u] [-p PID] [-i INTERVAL] [-T] [duration]
#
# PLEASE DO NOT RUN THIS IN PRODUCTION! This is a work in progress, intended to
# explore chain graphs on Linux, using eBPF capabilities from a particular
# kernel version (4.3ish). This tool will eventually get much better.
@dreness
dreness / fix-aifc.sh
Last active May 7, 2022 18:52
Attempt to repair an interrupted QuickTime Player audio recording
#!/bin/zsh
# https://gist.github.com/dreness/e61fb16dcb831adaf6ff
# dre@mac.com
#
# This script attempts to repair Quicktime Player audio recordings
# that become broken when Quicktime Player is interrupted while recording.
# AIFC files can be recovered with no additional help, however to recover
# M4A files, you also need the 'faad' command line tool.
@jesseschalken
jesseschalken / code_style.md
Last active August 17, 2024 14:44
Code style

My preferred code style is 2-space K&R. This is intended to provide a justification for this style.

Why K&R?

K&R style has the following properties:

  1. Provides symmetric size (in terms of screen space consumed) between the opening and closing syntax of a clode block.
  2. Forces no empty or meaningless lines, thereby avoiding artificial distance between related things that should be together.
  3. Consumes the minimum vertical space while keeping the opening and closing syntax of a block on separate lines from the content.