Skip to content

Instantly share code, notes, and snippets.

@masbog
masbog / float2hex.cpp
Created April 10, 2013 10:53
How To Create Hex or Binary Value from Float Point how ho use : compile first using 'g++ float2hex.cpp' and then rename a.out to float2hex last copy float2hex into /usr/local/bin result : Macintosh:masbog$ float2hex 2.34 Your Float value is : 2.340000 Result Float to Hex is : 0x4015C28F Your binary value is : 0100 0000 0001 0101 0010 1000
#include <bitset>
#include <string>
#include <iostream>
#include <sstream>
using namespace std;
int main(int argc, char **argv)
{
if(int(argc) > 1)
@masbog
masbog / macro.h
Created April 17, 2013 02:52
Objective-C Macro write log for calling function
#define logC NSLog(@"%@", NSStringFromSelector(_cmd));
#define logP NSLog(@"%s", __PRETTY_FUNCTION__);
//example to use
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
logC;
logP;
}
@masbog
masbog / how to
Created July 22, 2013 19:21
Code Sign error: Provisioning profile can't be found
Here's how I did it.
Shut down Xcode.
Back up the project.pbxproj file.
Edit the project.pbxproj file and remove lines of instances where it mentions the old provisioning profile.
eg. Delete line:
PROVISIONING_PROFILE = "8D024EDA-DC05-40DF-B3EB-536392615EE2";
Restart Xcode and perform a full clean of the project.
It should then build without warnings.
Enjoy!
@masbog
masbog / replace_image_path.sh
Created August 1, 2013 06:50
Change file image path xcode xib image resource into your application image bundle
find . -name '*.xib' -exec echo {} \; -exec sed -E -i "" -e 's/>([a-zA-Z0-9_\@\.]+)(\.png)/>your_name_bundle\.bundle\/\1\2/' {} \;
//
// Copyright (c) 2012-2013 Cédric Luthi / @0xced. All rights reserved.
//
#if TARGET_IPHONE_SIMULATOR
static const char *fakeCarrier;
#import <objc/runtime.h>
@masbog
masbog / isPirated.m
Created August 3, 2013 19:58
How to detect your paid iOS application was pirated by someone
NSBundle *bundle = [NSBundle mainBundle];
NSDictionary *info = [bundle infoDictionary];
if ([info objectForKey: @"SignerIdentity"] != nil)
{
/* do something do you want*/
}

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

# !/bin/bash
# Copyright (c) 2011 Float Mobile Learning
# http://www.floatlearning.com/
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
@masbog
masbog / step.txt
Created September 6, 2013 19:10
How to install Chromaprin audio fingerprint at CentOS 64 bit
[root@server chromaprint]# yum install git ffmpeg ffmpeg-devel fftw taglib boost cmake
[root@server chromaprint]# git clone https://masbog@bitbucket.org/masbog/chromaprint.git && cd chromaprint
[root@server chromaprint]# cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX=/usr -DLIB_SUFFIX=64 .
[root@server chromaprint]# make && install
test your chromaprint is work?
[root@server chromaprint]# fpcalc ../mp3/BrunoMars_Grenade.mp3
FILE=../mp3/BrunoMars_Grenade.mp3
DURATION=222
@masbog
masbog / dedup.py
Created September 7, 2013 04:07 — forked from plamere/dedup.py
#!/usr/bin/python
import sys
import os
import pprint
import subprocess
import pickle
import atexit
import simplejson as json
sys.path.insert(0, "../API")