Skip to content

Instantly share code, notes, and snippets.

View andrey-str's full-sized avatar

Andrey Streltsov andrey-str

View GitHub Profile
@andrey-str
andrey-str / xcodeSwitch.sh
Created March 20, 2012 07:47 — forked from doronkatz/xcodeSwitch.sh
XCode switch script
$ sudo /usr/bin/xcode-select -switch /Applications/Xcode.app
#!/bin/bash
# https://gist.github.com/949831
# http://blog.carbonfive.com/2011/05/04/automated-ad-hoc-builds-using-xcode-4/
# command line OTA distribution references and examples
# http://nachbaur.com/blog/how-to-automate-your-iphone-app-builds-with-hudson
# http://nachbaur.com/blog/building-ios-apps-for-over-the-air-adhoc-distribution
# http://blog.octo.com/en/automating-over-the-air-deployment-for-iphone/
# http://www.neat.io/posts/2010/10/27/automated-ota-ios-app-distribution.html
@andrey-str
andrey-str / isup.py
Last active August 29, 2015 14:17 — forked from andrix/isup.py
#!/usr/bin/env python
import re
import sys
from urllib import urlopen
def isup(domain):
resp = urlopen("http://www.isup.me/%s" % domain).read()
return "%s: %s" % (domain, "UP" if re.search("It's just you.", resp,
re.DOTALL) else "DOWN")
@andrey-str
andrey-str / lldb_qt.py
Last active August 29, 2015 14:23 — forked from wmanth/lldb_qt.py
import lldb
def __lldb_init_module(debugger, internal_dict):
debugger.HandleCommand('type summary add QString -F lldb_qt.QString_summary')
debugger.HandleCommand('type summary add QUuid -F lldb_qt.QUuid_summary')
print 'lldb_qt.py has been loaded and is ready for use.'
def QString_summary(value, internal_dict):
name = value.GetName()
deref = '->' if value.TypeIsPointerType() else '.'
@andrey-str
andrey-str / NSDictionary+XXXConvertValues.h
Created November 12, 2015 08:59 — forked from kristopherjohnson/NSDictionary+XXXConvertValues.h
Category on NSDictionary that will convert string values to numbers or vice versa. Useful for JSON deserialization.
#import <Foundation/Foundation.h>
@interface NSDictionary (XXXConvertValues)
// Return value associated wth key, converted to NSString
- (NSString *) stringValueForKey:(id)key;
// Return integer value associated with key, converted to integer
- (NSInteger) integerValueForKey:(id)key;
@andrey-str
andrey-str / ape2mp3.sh
Created January 6, 2016 09:08 — forked from jingle/ape2mp3.sh
Convert ape to mp3 using avconv, split with mp3splt and cue
#!/bin/bash
find "$1" -type f -name "*.ape" -print0 | while read -d $'\0' song
do
output=${song%.ape}.mp3
cue=${song%.ape}.cue
avconv -i "$song" -b 192k "$output"
if ls "$cue" &> /dev/null; then
mp3splt -a -c "$cue" "$output"
@andrey-str
andrey-str / integer.rb
Created April 25, 2016 10:38 — forked from pithyless/integer.rb
Ruby Integer::MAX and Integer::MIN
class Integer
N_BYTES = [42].pack('i').size
N_BITS = N_BYTES * 16
MAX = 2 ** (N_BITS - 2) - 1
MIN = -MAX - 1
end
p Integer::MAX #=> 4611686018427387903
p Integer::MAX.class #=> Fixnum
p (Integer::MAX + 1).class #=> Bignum
@andrey-str
andrey-str / singleton.m
Created May 4, 2016 13:35 — forked from abbeyjackson/sharedInstance Singleton
sharedInstance singleton
+ (instancetype)sharedInstance
{
static dispatch_once_t once;
static id sharedInstance;
dispatch_once(&once, ^{
sharedInstance = [[self alloc] init];
});
return sharedInstance;
}
@andrey-str
andrey-str / README.md
Created June 10, 2016 13:28 — forked from cjolly/README.md
How to securely set rails secret key when you deploy to Heroku.

Stop Versioning Rails Secret Tokens

After reading Code Climate's Rails' Insecure Defaults I realized I was guilty of breaking rule 3. Versioned Secret Tokens. Here's how I fixed it.

Use dotenv in development and test environments:

# Gemfile
gem 'dotenv-rails', groups: [:development, :test]
@andrey-str
andrey-str / GIF-Screencast-OSX.md
Created July 3, 2016 07:31 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: