Skip to content

Instantly share code, notes, and snippets.

@dkonst
dkonst / psv_decryptor.py
Created September 27, 2023 22:10 — forked from bitsnaps/psv_decryptor.py
Decrypt PSV file for mac
# This script is inspired from: https://github.com/kigaita/PsvDecryptCore
# It allows you to decrypt psv video files for online developer training website
# The original code was written with .NET for Windows users, this one with Python tested for Mac users.
# *** Disclaimer ****
# Please only use it for your convenience so that you can watch the courses on your devices offline or for educational purposes.
# Piracy is strictly prohibited. Decrypted videos should not be uploaded to open servers, torrents, or other methods of mass distribution. Any consequences resulting from misuse of this tool are to be taken by the user.
# packages you may need to install:
# pip install python-magic
@dkonst
dkonst / graffle2hash.rb
Created May 7, 2018 12:07 — forked from iloveitaly/graffle2hash.rb
Convert Hierarchical OmniGraffle Document to JSON
#!/usr/bin/env ruby
# rubycocoa
require 'osx/cocoa'
include OSX
OSX.require_framework 'ScriptingBridge'
class GraffleConverter
def initialize
@graffle = SBApplication.applicationWithBundleIdentifier_("com.omnigroup.OmniGraffle")
@dkonst
dkonst / spy.d
Created February 2, 2016 15:56 — forked from markd2/spy.d
Look at objective-C messages being sent in an application running in the simulator. "Interesting" symbols (configured in the first BEGIN block, or one provided on the command line) will get stack traces dumped. "ignored" symbols are not logged.
#!/usr/sbin/dtrace -s
/* Run like:
% sudo csh
# ./spy.d $PROCESS_ID [$INTERESTING_PROBEPROV]
Prints a line of dashes every 5 seconds to delineate different experiments.
*/
#pragma D option quiet
@dkonst
dkonst / allTimeZoneInfomations.csv
Last active August 29, 2015 14:25 — forked from norio-nomura/allTimeZoneInfomations.csv
All timezones supported by OS X 10.10
name standard name(en_US) standard name(ja_JP) short transition dates
Africa/Abidjan Greenwich Mean Time グリニッジ標準時 GMT
Africa/Accra Greenwich Mean Time グリニッジ標準時 GMT
Africa/Addis_Ababa East Africa Time 東アフリカ時間 GMT+3
Africa/Algiers Central European Standard Time 中央ヨーロッパ標準時 GMT+1
Africa/Asmara East Africa Time 東アフリカ時間 GMT+3
Africa/Bamako Greenwich Mean Time グリニッジ標準時 GMT
Africa/Bangui West Africa Standard Time 西アフリカ標準時 GMT+1
Africa/Banjul Greenwich Mean Time グリニッジ標準時 GMT
Africa/Bissau Greenwich Mean Time グリニッジ標準時 GMT
@dkonst
dkonst / gist:c56bfd9b1877cac5d9c1
Created December 5, 2014 15:40
monitor mach ports for a process
pid=`pgrep TextEdit` sudo dtrace -n 'pid$pid::mach_port_allocate:entry,pid$pid::mach_port_destroy:entry,pid$pid::mach_port_deallocate:entry { ustack(); }'
@dkonst
dkonst / gist:d74d0f41861af6efae9e
Created December 5, 2014 14:31
view image information
$ sips -g all image.png
# pixelWidth: 32
# pixelHeight: 32
# typeIdentifier: public.png
# format: png
# formatOptions: default
# dpiWidth: 72.000
# dpiHeight: 72.000
# samplesPerPixel: 4
@dkonst
dkonst / gist:2ee2dede5947547927c1
Created October 9, 2014 09:20
list usb devices from command line
system_profiler SPUSBDataType
@dkonst
dkonst / gist:4c9b623911dd278af776
Last active July 5, 2016 20:47
pulse-eight p8 cec-client commands for rpi / p8 cec adapter
# query p8 cec-adapter about firmware etc
$ cec-client -d 1 -s -l
log level set to 1
Found devices: 1
device: 1
com port: /dev/cu.usbmodemv2 r1
vendor id: 2548
product id: 1002
firmware version: 4
@dkonst
dkonst / gist:7e7cff6ea38f4f5b20e1
Last active August 29, 2015 14:02 — forked from fjcaetano/gist:b0c00a889dc2a17efad9
quick sort in swift
var randomNumbers = [42, 12, 88, 62, 63, 56, 1, 77, 88, 97, 97, 20, 45, 91, 62, 2, 15, 31, 59, 5]
func partition(v: Int[], left: Int, right: Int) -> Int {
var i = left
for j in (left + 1)..(right + 1) {
if v[j] < v[left] {
i += 1
(v[i], v[j]) = (v[j], v[i])
}
}
@dkonst
dkonst / gist:77295bacda53a8feee48
Last active August 29, 2015 14:01 — forked from jstn/gist:5451843
QTMovie frame rate
- (NSTimeInterval)frameRateForMovie:(QTMovie *)movie
{
for (QTTrack *track in [movie tracks]) {
QTMedia *media = [track media];
if (![media hasCharacteristic:QTMediaCharacteristicHasVideoFrameRate])
continue;
QTTime duration = [(NSValue *)[media attributeForKey:QTMediaDurationAttribute] QTTimeValue];
long sampleCount = [(NSNumber *)[media attributeForKey:QTMediaSampleCountAttribute] longValue];
return sampleCount * ((NSTimeInterval)duration.timeScale / (NSTimeInterval)duration.timeValue);
}