Skip to content

Instantly share code, notes, and snippets.

View directmusic's full-sized avatar
🗨️
idk

Joseph Lyncheski directmusic

🗨️
idk
View GitHub Profile
@yyny
yyny / advanced_looping.c
Created April 3, 2021 19:04
Advanced Looping using `miniaudio` library
#define MINIAUDIO_IMPLEMENTATION
#include <miniaudio.h>
#include <stdio.h>
ma_uint32 first_frame; // frame to start looping
ma_uint32 last_frame; // frame to end looping (exclusive)
ma_uint32 num_frames; // number of frames to loop
void data_callback(ma_device* pDevice, void* pOutput, const void* pInput, ma_uint32 frameCount)
@albertzsigovits
albertzsigovits / ida.txt
Created January 31, 2019 10:30
IDA Pro Tips and Tricks
# IDA Pro Keyboard shortcuts and tips:
######################################
Ctrl+E - Return to entry point
Alt+M - Set bookmark
Ctrl+M - List bookmarks
Space - Toggle full screen/workflow view
Esc - Backup to parent function
Ctrl+X - Find All X-References
Ctrl+R - Change reference information e.g deltas etc.
@glaurent
glaurent / ListCoreAudioDevices.swift
Last active July 11, 2023 07:50 — forked from robotconscience/SelectAudioOutput.mm
List CoreAudio devices in Swift
import Foundation
import CoreAudio
var propertyAddress = AudioObjectPropertyAddress(mSelector: kAudioHardwarePropertyDevices, mScope: kAudioObjectPropertyScopeGlobal, mElement: kAudioObjectPropertyElementMaster)
var propertySize:UInt32 = 0
if AudioObjectGetPropertyDataSize(AudioObjectID(kAudioObjectSystemObject), &propertyAddress, 0, nil, &propertySize) == noErr {
let numDevices = Int(propertySize) / MemoryLayout<AudioDeviceID>.size
@gbaman
gbaman / HowToOTG.md
Last active June 24, 2024 16:18
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int

@JeOam
JeOam / NSZombieEnabled.md
Created July 8, 2014 02:05
NSZombieEnabled

NSZombieEnabled is an environment variable which controls whether the Foundation runtime will use zombies. When zombies are enabled, a deallocated object's class is dynamically changed to be _NSZombie, and by default, the memory region is never marked as free, although this can be controlled separately(so, remember to disable NSZombieEnabled for Archived Release Build).

The end result is that, with zombies enabled, messages to deallocated objects will no longer behave strangely or crash in difficult-to-understand ways, but will instead log a message and die in a predictable and debugger-breakpointable way. This is the tool to use when trying to track down over-releases and premature releases.

Zombies will take effect for all Objective-C objects that are deallocated through normal means, including most Cocoa classes as well as user-created classes. On 10.4 and earlier, a rather important exception to this is most/all TollFreeBridged classes, as they are deallocated using CoreFoundation which NSZombieEnab

@akihiroy
akihiroy / stack_trace.cpp
Created January 22, 2013 09:53
Stack trace function for windows
#include <windows.h>
#define DBGHELP_TRANSLATE_TCHAR
#include <DbgHelp.h>
void StackTrace()
{
CONTEXT context = {0};
#if defined(_M_X64)
RtlCaptureContext(&context);
#else