Skip to content

Instantly share code, notes, and snippets.

View alimoeeny's full-sized avatar
💭
Strong Opinions Weakly Held

Ali Moeeny alimoeeny

💭
Strong Opinions Weakly Held
View GitHub Profile
#register this with ELB
# what is my name
myname=$(curl http://169.254.169.254/latest/meta-data/instance-id)
# what is my AvailabilityZone
myaz=$(curl http://169.254.169.254/latest/meta-data/placement/availability-zone)
#What is my region
myregion=${myaz%?}
#!/bin/bash
# Auto Increment Version Script
# Make sure you have or create CFBuildNumber and CFBuildVersion in your info.plist
buildPlist="FlowHealth/FlowHealth-Info.plist"
buildVersion=$(/usr/libexec/PlistBuddy -c "Print CFBuildVersion" $buildPlist)
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBuildNumber" $buildPlist)
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBuildNumber $buildNumber" $buildPlist
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildVersion.$buildNumber" $buildPlist
@alimoeeny
alimoeeny / emptyjson.go
Created August 11, 2014 20:33
Empty things in json
package main
import (
"encoding/json"
"fmt"
)
type Book struct {
Title string `json:"title,omitempty"`
Author string `json:"author,omitempty"`
This file has been truncated, but you can view the full file.
brew install -v gcc 2>&1
==> Downloading http://ftpmirror.gnu.org/gcc/gcc-4.9.1/gcc-4.9.1.tar.bz2
Already downloaded: /Library/Caches/Homebrew/gcc-4.9.1.tar.bz2
==> Verifying gcc-4.9.1.tar.bz2 checksum
tar xf /Library/Caches/Homebrew/gcc-4.9.1.tar.bz2
==> Patching
==> ../configure --build=x86_64-apple-darwin14.0.0 --prefix=/usr/local/Cellar/gcc/4.9.1_1 --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-4.9 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-cloog=/usr/local/opt/cloog --with-isl=/usr/local/opt/isl --with-system-zlib --enable-version-specific-runtime-libs --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --disable-werror --with-pkgversion=Homebrew gcc 4.9.1_1 --with-bugurl=https://github.com/Homebrew/homebrew/issues --enable-plugin --disable-nls --enable-multilib
checking build system type... x86_64-apple-darwin14.0.0
checking host system type... x86_64-apple-darwin14.0.0
checking target sys
var window: UIWindow?
var sideMenuViewController: RESideMenu?
var rootTabVC: UITabBarController?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// about
var about : AboutViewController = AboutViewController(nibName: "AboutView_iphone", bundle: nil)
about.title = "About"
@alimoeeny
alimoeeny / hack.sh
Created March 31, 2012 22:37 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@alimoeeny
alimoeeny / loadWithPrefix.m
Created July 9, 2012 17:35
loadWithPrefix loads the varialbles in a mat file into the base workspace
function loadWithPrefix(matFileName, prefix)
load(matFileName)
allVariables = who;
for i = 1:length(allVariables)
if (strcmp(allVariables{i}, 'prefix') || strcmp(allVariables{i}, 'matFileName'))
%
else
disp([allVariables{i} ' -> ' prefix allVariables{i}]);
eval(['assignin(''base'', [prefix allVariables{i}] ,' allVariables{i} ');']);
end
@alimoeeny
alimoeeny / gist:4065881
Created November 13, 2012 13:55
login draft
<html>
<body>
<script>
alert('ali here');
function showResults(a)
{
for(var key in a['data'])
{
if (a['data'].hasOwnProperty(key)) { // this will check if key is owned by data object and not by any of it's ancestors
alert(key+': '+a['data'][key]); // this will show each key with it's value
@alimoeeny
alimoeeny / gist:6048921
Created July 21, 2013 15:46
~/.gitconfig
[color]
ui = true
[alias]
lol = log --pretty=oneline --abbrev-commit --graph --decorate
la = log --pretty=\"format:%ad %h (%an): %s\" --date=short
dw = diff --word-diff
sb = status -sb
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C( bold blue)<%an>%Creset' --abbrev-comm it --
lp = log -p
@alimoeeny
alimoeeny / pre-commit
Last active December 25, 2015 16:29
git pre-commit hook for automatic versioning on every commit in Matlab
#!/bin/sh
#read more at http://alimoeenysbrain.blogspot.com/2013/10/automatic-versioning-with-git-commit.html
#replace all MYPROJECT with your project name
#for languages other than matlab replace all the .go extensions with your language extensions and modify BODY to reflect you language syntax
#for go (golang) see this gits: https://gist.github.com/alimoeeny/7005725
VERBASE=$(git rev-parse --verify HEAD | cut -c 1-7)
echo $VERBASE
NUMVER=$(awk '{printf("%s", $0); next}' MYPROJECTversion.m | sed 's/.*MYPROJECT\.//' | sed 's/\..*//')