Skip to content

Instantly share code, notes, and snippets.

View ikonst's full-sized avatar

Ilya Priven ikonst

  • New York, NY
  • 22:21 (UTC -04:00)
View GitHub Profile
@ikonst
ikonst / git_tfs_add_date.pl
Created March 31, 2014 16:43
git commit message filter that adds the original committer timestamp to the comment. (This is due to the fact that it's impossible to specify a timestamp during TFS checkin.)
#!/usr/bin/perl
#
# Execute with:
#
# git filter-branch -f --msg-filter 'perl /path/to/git_tfs_add_date.pl' HEAD
#
use POSIX;
open INPUT, "<-";
$ENV{'GIT_COMMITTER_DATE'} =~ /^@(.*) \+(\d\d)(\d\d)/;
@ikonst
ikonst / gst.py
Last active August 29, 2015 14:14
GStreamer extensions for LLDB
# To use:
# 1) Save to $HOME
# 2) echo 'command script import ~/gst.py' >> ~/.lldbinit
# 3) From within lldb:
#
# To open pipeline graph in Graphviz:
#
# gst_dot foobar
#
# foobar: any expression of type GstObject* -- e.g. GstElement*, GstPad* or GstBin*
@ikonst
ikonst / gist:8f94b537731d8a1744cb
Created March 31, 2015 13:43
Connecting GLib g_log to NSLog
void my_log_handler(const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data)
{
NSLog(@"%@", [NSString stringWithUTF8String:message]);
}
...
g_log_set_default_handler( my_log_handler, NULL);
@ikonst
ikonst / applemedia-setjmp-longjmp.patch
Created April 5, 2015 03:33
avfvideosrc: setjmp/longjmp patch
From c3199506fd03e77b61cd6fdfbd8184e1effb28ba Mon Sep 17 00:00:00 2001
From: Ilya Konstantinov <ilya.konstantinov@gmail.com>
Date: Sun, 5 Apr 2015 05:39:14 +0300
Subject: [PATCH] applemedia: setjmp/longjmp
Migrate the pipeline into the AVFoundation dispatch queue thread
to enable operation without context switching and unneeded yielding.
---
sys/applemedia/avfvideosrc.m | 101 ++++++++++++++++++++++++++++---------------
1 file changed, 66 insertions(+), 35 deletions(-)
@ikonst
ikonst / NSMutableAttributedString+FontWithFamily.h
Last active August 29, 2015 14:25
Enables creating a UIFont that's a variant of another font in a different family
@import Foundation;
@interface NSMutableAttributedString (FontWithFamily)
// Modifies the attributed text to change the font family while keeping
// font size and traits.
- (void)setFontFamily:(NSString *)fontFamily inRange:(NSRange)range;
- (void)setFontFamily:(NSString *)fontFamily;
@end
@ikonst
ikonst / cancelable_worker_thread.c
Last active August 29, 2015 14:25
Cancelable worker thread
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <pthread.h>
#include <sys/time.h>
#include <sys/errno.h>
struct thread_data {
pthread_cond_t cond;
int finished;
@ikonst
ikonst / xcode-rainbow.c
Created July 27, 2015 17:30
XCode Rainbow Print
// Prints rainbow-colored text into the Xcode output window.
// Required the XcodeColors plugin:
// https://github.com/robbiehanson/XcodeColors
void XcodeRainbowLog(const char *str)
{
float hueStep = 1.0 / strlen(str);
float hue = 0.0;
for (char *c = str; *c != '\0'; ++c) {
UIColor *color = [UIColor colorWithHue:hue saturation:1 brightness:0.8 alpha:1];
hue += hueStep;
@ikonst
ikonst / libusb-1.0.9-android-log.patch
Created August 14, 2012 14:25
libusb 1.0.9 Android logging patch
--- libusb-1.0.9/libusb/core.c Fri Apr 20 09:44:27 2012
+++ libusb-1.0.9/libusb/core.c Tue Aug 14 17:29:08 2012
@@ -31,6 +31,10 @@
#include <sys/time.h>
#endif
+#ifdef __ANDROID__
+#include <android/log.h>
+#endif
+
@ikonst
ikonst / putty.iss.patch
Created November 9, 2012 15:35
PuTTY InnoSetup "Add to PATH" patch
Index: putty.iss
===================================================================
--- putty.iss (revision 9586)
+++ putty.iss (working copy)
@@ -77,6 +77,9 @@
Name: desktopicon\user; Description: "For the current user only"; GroupDescription: "Additional icons:"; Flags: exclusive unchecked
Name: quicklaunchicon; Description: "Create a &Quick Launch icon for PuTTY (current user only)"; GroupDescription: "Additional icons:"; Flags: unchecked
Name: associate; Description: "&Associate .PPK files (PuTTY Private Key) with Pageant and PuTTYgen"; GroupDescription: "Other tasks:"
+Name: path; Description: "Add PuTTY to the system &path"; GroupDescription: "Other tasks:"
+Name: path\common; Description: "For all users"; GroupDescription: "Other tasks:"; Flags: exclusive unchecked
@ikonst
ikonst / MountInfo.java
Created August 19, 2012 12:50
Java code to parse /proc/mounts.
import java.io.*;
import java.nio.charset.Charset;
import java.util.*;
/**
* Parses of /proc/mounts.
*/
public class MountInfo {