Skip to content

Instantly share code, notes, and snippets.

View leontiy's full-sized avatar

Leon Deriglazov leontiy

  • JPMorgan Chase & Co.
  • London, UK
View GitHub Profile
#!/bin/bash
USAGE="usage: git-gc-all [repositories_directory]"
if [[ -z $1 ]]; then
wd=`pwd`
elif [[ $1 == "--help" ]]; then
echo "runs git-gc in each subdirectory of current directory."
echo $USAGE
exit
#!/usr/local/bin/python3.0
import os
import re
def skip_updated(input):
for line in input:
if not_updated_regexp.match(line):
return
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("image/png"); //or "message/rfc822"
ContentResolver cr = getContentResolver();
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(status.url));
String postfix = (status.recognized()) ? "success" : "failure";
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Captured images: " + postfix);
sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "[email protected]" });
startActivity(Intent.createChooser(sendIntent, "Send images"));
NSString * path = [[NSBundle mainBundle] pathForResource:<#Resource name#> ofType:@"plist"];
NSData * plistXML = [[NSFileManager defaultManager] contentsAtPath: path];
NSString * errorDesc = nil;
NSPropertyListFormat format;
<#Variable name#> = (<#Type of top level element#> *)[NSPropertyListSerialization propertyListFromData:plistXML mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&errorDesc];
if (nil == <#Variable name#>) {
NSLog(@"Can not load <#What#>.");
if (errorDesc) {
NSLog(@"Error description: %@", errorDesc);
[errorDesc release]; errorDesc = nil;
@leontiy
leontiy / .sh
Created June 27, 2010 02:28
.zshrc
export LC_CTYPE=en_US.UTF-8
export PATH=$PATH:~/scripts:/opt/local/bin:/Developer/usr/bin:/usr/local/texlive/2009/bin/universal-darwin:/usr/local/git/bin/
export EDITOR='mate -w'
export GIT_EDITOR="mate -wl1"
export LESSEDIT='mate -l %lm %f'
PS1="%n@%m:%20~%#> "
autoload -U compinit
compinit
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b'
@leontiy
leontiy / .gitignore
Created October 18, 2011 06:53
My global .gitignore file.
.DS_Store
.svn
*.mode1v3
*.pbxuser
project.xcworkspace
@leontiy
leontiy / UIDeviceHardware.h
Created April 27, 2012 04:06 — forked from Jaybles/UIDeviceHardware.h
UIDeviceHardware - Determine iOS device being used
//
// UIDeviceHardware.h
//
// Used to determine EXACT version of device software is running on.
#import <Foundation/Foundation.h>
@interface UIDeviceHardware : NSObject
+ (NSString *) platform;
@leontiy
leontiy / lj-to-dayone
Last active December 26, 2021 18:24
A (not so) simple python script to import Live Journal's XML export files to Day One for Mac.
#!/usr/bin/python
# HOW TO USE THIS SCRIPT:
# 0. Install [Day One CLI](http://dayoneapp.com/tools/)
# 1. Get your XML files using [Live Journal's export form](http://www.livejournal.com/export.bml)
# 2. Run this script against every exported file (yes, you get tons of XML files — it's a good idea to automate this step). The shell command should look like this
# `ls -1 *.xml | xargs -n1 lj-to-dayone -u username`
# assuming you have all your XMLs in current directory and lj-to-dayone on your PATH (or in the same directory).
# Author: Leonty Deriglazov, 14/07/2013.
@leontiy
leontiy / merge_localizations.py
Last active August 29, 2015 14:01
Merge localisation files
#!/usr/bin/python
import re
import sys
import codecs
generated_regex = re.compile(r"/\*(?P<comment>.*?)\*/[\n\r]*\"(?P<key>.*?)\"\s*=\s*\"(?P<value>.*?)\";", re.S)
handcrafted_regex = re.compile(r"\"(?P<key>.*?)\"\s*=\s*\"(?P<value>.*?)\";(?P<comment>)", re.S)
def parse(file_name, regex, encoding = "utf-8"):
@leontiy
leontiy / gist:685a5a7e72efcbdf415c
Created October 22, 2014 16:59
UIStatusBar method selectors
_adjustDoubleHeightTextVisibility
_backgroundFrameForAttributes:
_backgroundView
_beginDisablingRasterizationForReason:
_clearOverrideHeight
_crossfadeToNewBackgroundView
_crossfadeToNewForegroundViewWithAlpha:
_currentComposedData
_currentComposedDataForStyle:
_currentStyleAttributes