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: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);
}
// main.m
// creategif
//
// Created by Kevin Meaney on 21/10/2013.
// I've briefly blogged about it here:
// http://blog.yvs.eu.com/2013/10/creating-gif-animations-using-coreimagequartz
// The following code is all that is all the code needed for a creating a command line tool to generate
// a gif animation from image files.
// The main limitation with this code is that apart from the frame delay time of 0.1 second, every
@dkonst
dkonst / man2epub
Created April 28, 2014 12:01 — forked from f110/gist:4746105
#!/bin/bash
set -e
FILE=`man -w $1`
command=`echo $FILE | sed -e "s/.*\/\(.*\)\..*$/\1/"`
TMP_FILE=/tmp/for-epub-$command.html
EPUB_FILE=`pwd`/$command.epub
man $command | man2html > $TMP_FILE
~/Applications/calibre.app/Contents/MacOS/ebook-convert $TMP_FILE $EPUB_FILE --no-default-epub-cover --title "$command" --language "en" --dont-split-on-page-breaks
@dkonst
dkonst / literals.m
Created August 28, 2012 10:41 — forked from jeremy-w/literals.m
Tops script to convert code to use Obj-C literals
// clang -g -Weverything -framework Foundation literals.m -o literals
/* @file literals.m
* @author Jeremy W. Sherman
* @url http://jeremywsherman.com/
* @date 2012-08-27 */
#import <Foundation/Foundation.h>
int
main(void)
{