Skip to content

Instantly share code, notes, and snippets.

@randombrein
randombrein / pre-push_call-another
Last active December 31, 2015 10:29
'pre-push' script that prompt the push to user andthen call another script which exist at %rel_path/%script_name(mostly lays at $SRCROOT)
#!/bin/bash
############################
# 'pre-push' script that prompt the push to user and
# then call another script which exist at %rel_path/%script_name
# (mostly lays at $SRCROOT)
#set your script
script_name="another.sh"
#relative path
@randombrein
randombrein / bump-version_xcode.sh
Last active December 31, 2015 10:39
Xcode bump-version script using 'xcodebuild -showBuildSettings'
#!/bin/bash
function get_env_val {
path=$(xcode-select -print-path)
var=$($path/usr/bin/xcodebuild -showBuildSettings | sed -n -e 's/'"$1"' = \(.*\)/\1/p')
echo $var
}
SRCROOT=$(get_env_val "SRCROOT")
@randombrein
randombrein / postbuild-testflight.sh
Last active January 1, 2016 22:39
Xcode post-build action script to send adhoc to TestFlight over Upload API.
#!/bin/bash
################################
# Xcode post-build action script
# to send adhoc to TestFlight over Upload API
#
TESTFLIGHT_BUILD=1
if [[ $TESTFLIGHT_BUILD -ne 1 ]]
then
exit
@randombrein
randombrein / .bash_profile
Created June 15, 2014 19:03
my awesome bashrc under mavericks
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacadexport
export PATH="$HOME/bin:$PATH"
export PATH="/usr/local/bin:$PATH"
export PATH="/usr/local/sbin:$PATH"
alias ll='ls -l'
alias nano='nano -m -S'
alias subl="'/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl'"
@randombrein
randombrein / ril2srl.py
Last active November 21, 2015 11:47
sync Pocket (read it later) data with safari's reading list
import shutil
from os.path import expanduser, dirname, abspath, join, isfile
from datetime import datetime as dt
import lxml.html
from biplist import readPlist, writePlist, InvalidPlistException, NotBinaryPlistException
from time_uuid import TimeUUID
"""
TODO:
- read/unread

Keybase proof

I hereby claim:

  • I am randombrein on github.
  • I am randombrein (https://keybase.io/randombrein) on keybase.
  • I have a public key whose fingerprint is 2C32 B010 07BB F5D2 9D6A 928D 5276 996E 63B2 9769

To claim this, I am signing this object:

/*
We have to jump through some serious hoops to get the bundle of the caller;
[self class] doesn't work reliably when our classes are generated at the runtime.
Instead, we fetch the return address, look up the container image,
and attempt to match it against a loaded bundle.
*/
NSBundle *bundle = nil;
void *p = __builtin_return_address(0);
@randombrein
randombrein / receptionistPattern.m
Created April 5, 2015 20:22
Receiptionist patter over KVO
#import <Foundation/Foundation.h>
typedef void (^ReceptionistTask)(NSString *keyPath, id obj, NSDictionary *change);
@interface Receptionist : NSObject
+ (instancetype)receptionistForObject:(id)obj withKeyPath:(NSString*)keyPath withQueue:(NSOperationQueue*)queue withTask:(ReceptionistTask)task;
@end
@implementation Receptionist {
id _observerdObj;
# -*- coding: utf-8 -*-
"""
Monotonic increasing sinusoidal curve with same entrance/exit angle
"""
import numpy as np
import pylab
def discrt_tan(x0, y0, x1, y1):
@randombrein
randombrein / sinusoidal_monotonic_curve.ipynb
Created October 23, 2016 21:40
sinusoidal_monotonic_curve notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.