Tuesday, November 29, 2016

libasutils - Some c++ utilities that come in handy at times

Latest project involves c++.  I needed some utilities and I needed them my way!  I used a bunch of helper libraries and also rolled some of my own.  Some useful stuff, I'm sure there are others that do the same and maybe part of the STD has it but I wanted a bit of learning as well.  Things it currently has:

  1.  Http server - thin c++ wrapper around gnu libmicrohttpd
  2.  EPOLL high performance sockets for client/server 
  3.  Thread pool
  4.  Utils - sha1 (wraps boosts), timestamps, timestamp converter, split
  5.  Buffered reader and writer

It's linux only.

https://github.com/asharif/libasutils

Wednesday, April 6, 2016

setting up ssh tunnel

Just so I don't forget in my old age.  Here is how to setup an ssh tunnel:

ssh user@remote -L 8081:remote:8080 -N

this sets up a tunnel that forwards all calls to localhost:8081 to remote:8080.  If you want the command to give you back your terminal session you need a -f flag

Thursday, February 4, 2016

make-ios - peace out XCODE IDE!

So awhile ago, I got so frustrated with Android Studio and the crappy build system that is gradle, that I decided to create a Makefile so I understood what was going on (http://orphanware.blogspot.com/2014/08/androids-bloated-build-system-be-damned.html). It turned out the actual commands to run and create an Android project are not hard, but rather interesting.

Anyway, more recently I decided to do the same with iOS.  The results were MUCH simpler than the Android version since android has to convert java *.class files to a *.dex file, among other tedious steps. You still need to download XCODE from the App Store as the only way that I'm aware of getting the iOS SDK is to download the IDE.  Anyway without further blabbering.  Will upload as sample app to github in a later post:


SRC=`pwd`/src/objc/m/** INC=-I`pwd`/src/objc/h/ LIB=-l xml2.2 `pwd`/lib/dummylib -l z.1.2.5 FRAMEWORKS=-framework Foundation -framework UIKit -framework AVFoundation -framework CoreGraphics ISYSROOT=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/ ARCH64=-arch arm64 -miphoneos-version-min=6 ARCHV7=-arch armv7 -miphoneos-version-min=6 TMP_ARCH64_BIN=tmp/ioscliapp_arch64 TMP_ARCHV7_BIN=tmp/ioscliapp_archv7 BIN=bin/Payload/iosapp.app/iosapp #this is just the string value that you find in your OSX keychain for your certificate CERT=`cat /etc/ios_cert_name` BUNDLEID="org.orphanware.iosapp" default: pre arch64 archv7 post pre: @mkdir -p bin/Payload/iosapp.app/ @mkdir -p tmp/obj/ @cp etc/Info.plist bin/Payload/iosapp.app/ @cp etc/ProvisionProfile.mobileprovision bin/Payload/iosapp.app/embedded.mobileprovision post: @lipo -create $(TMP_ARCH64_BIN) $(TMP_ARCHV7_BIN) -output $(BIN) @codesign -f -s "$(CERT)" --entitlements etc/entitlements.plist bin/Payload/iosapp.app @cd bin/; zip -qr iosapp.ipa Payload/ arch64: @gcc -Wall -g -c -ObjC $(SRC) $(INC) $(ISYSROOT) $(ARCH64) @mv *.o tmp/obj/ @gcc -o $(TMP_ARCH64_BIN) tmp/obj/** -ObjC $(LIB) $(ISYSROOT) $(FRAMEWORKS) $(ARCH64) @rm tmp/obj/* archv7: @gcc -Wall -g -c -ObjC $(SRC) $(INC) $(ISYSROOT) $(ARCHV7) @mv *.o tmp/obj/ @gcc -o $(TMP_ARCHV7_BIN) tmp/obj/** -ObjC $(LIB) $(ISYSROOT) $(FRAMEWORKS) $(ARCHV7) @rm tmp/obj/* clean: @rm -rf tmp/ @rm -rf bin/*