Skip to content

Instantly share code, notes, and snippets.

@jasperf
jasperf / gist:91aa365454d00e44277d
Last active August 29, 2015 14:06
Stop Finder from indexing usb stick / flash drives / external harddisk by adding a hidden file #osx
cd /path/to/usb-drive
touch .metadata_never_index
@hiszpanski
hiszpanski / usblog.c
Created August 2, 2014 10:45
Prints vendor and product ids of USB devices as they are added
//
// main.c
// usblog
//
#include <assert.h>
#include <stdio.h>
#import <IOKit/usb/IOUSBLib.h>
@tomac
tomac / Iterator.c
Created June 30, 2014 14:06
Iterator
io_service_t usbDevice;
int action = 0;
while ((usbDevice = IOIteratorNext(iterator))) {
get_usb_device_info(usbDevice, newdev);
IOObjectRelease(usbDevice);
}
//gcc -o test_ez_read test_ez_read.c -lusb
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <stdarg.h>
#include <usb.h>
//Define
#define USB_VENDOR 0x1f00
@fbonzon
fbonzon / itunes_storefront_ids_scraper.php
Last active March 6, 2018 11:49
Scrapes and returns a list of all storefront IDs, aka 'sfID' tag in iTunes Store media files.
#!/opt/local/bin/php71
<?php
// Usage:
// ./itunes_storefront_ids_scraper.php > itunes_storefront_ids.pl
// Maybe we'll need to update those for future iTunes versions. With the user
// agent and store front HTTP headers, we trick the server into thinking that
// our requests come from iTunes.
const ITUNES_USER_AGENT =
@dky
dky / gist:4735912
Last active December 12, 2015 07:18
Disable journaling OSX
diskutil disableJournal /Volumes/Mac\ OSX\ usb
@scottmac
scottmac / serial.cpp
Created September 16, 2011 07:17
Find serial number of USB device on OS X.
#include <stdio.h>
#include <stdlib.h>
#include <IOKit/IOKitLib.h>
#include <IOKit/usb/IOUSBLib.h>
#include <IOKit/hid/IOHIDKeys.h>
CFStringRef find_serial(int idVendor, int idProduct) {
CFMutableDictionaryRef matchingDictionary = IOServiceMatching(kIOUSBDeviceClassName);