Skip to content

Instantly share code, notes, and snippets.

@bluebanboom
bluebanboom / Monitor.ino
Last active August 29, 2015 14:04
Monitor
/*
Monitor
*/
const int ledPin = 9; // the pin that the LED is attached to
void setup()
{
// initialize the serial communication:
Serial.begin(9600);
set-option -g utf8 on
set-option -g status-utf8 on
unbind '"'
bind - splitw -v #
unbind %
bind | splitw -h #
bind k selectp -U #
bind j selectp -D #
@bluebanboom
bluebanboom / buildipa.sh
Created September 13, 2013 02:29
编译ipa的脚本
#!/bin/bash
outpath="$HOME/"$PRODUCT_NAME"_IPAs"
subdirname=`date "+%Y-%m-%d_%H.%M.%S"`
ipaname=$PRODUCT_NAME"_"$subdirname".ipa"
apppath=$TARGET_BUILD_DIR"/"$PRODUCT_NAME".app"
sympath=$TARGET_BUILD_DIR"/"$PRODUCT_NAME".app.dSYM"
echo $outpath
if [ -d $outpath ]; then
@bluebanboom
bluebanboom / rc.local
Created June 18, 2013 03:42
show ip address on login screen
#!/bin/bash
ipaddr=$(ifconfig | sed -ne 's/ *inet addr:\([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\) *B.*/\1/p')
echo $'\x1b\x5b\x48\x1b\x5b\x32\x4a\x0a''Arch Linux \r ['$ipaddr'] (\n) (\l)' > /etc/issue
@bluebanboom
bluebanboom / OPRunOnce.h
Last active December 17, 2015 04:49
Run action only at current version first run. It is very easy to use. Just Call runOnce:action, specify the only key to the action and target.
//
// OPRunOnce.h
// Run action only at current version first run.
// It is very easy to use.
// Just Call runOnce:action, specify the only key to
// the action and target.
//
#import <Foundation/Foundation.h>
@bluebanboom
bluebanboom / safearc
Created April 8, 2013 05:35
Safe ARC.
# Automator service script
# sed -e's/\[//' 删[
# sed -e's/\]//' 删]
# sed -e's/ release//' 删release
# sed -e's/\([A-Za-z_0-9].*\);/SAFE_ARC_RELEASE(\1);/' 增加SAFE_ARC_RELEASE
sed -e's/\[//' | sed -e's/\]//' | sed -e's/ release//' | sed -e's/\([A-Za-z_0-9].*\);/SAFE_ARC_RELEASE(\1);/'
@bluebanboom
bluebanboom / embpython.c
Last active September 12, 2021 04:51
Example of embedding python in c.
#include <Python.h>
#include <stdio.h>
/*
* gcc embpython.c -I/usr/include/python2.7 -lpython
**/
void loadModule()
{
/* run objects with low-level calls */
char *arg1="sir", *arg2="robin", *cstr;
printf("Load Module err!\n");
@bluebanboom
bluebanboom / rename.sh
Created January 20, 2013 14:19
Simple batch rename shell
#!/bin/bash
# simple batch rename
cmd=""
ext=""
if [ "$#" -eq 1 ]; then
ext=$1
cmd="ls *."$ext
else
@bluebanboom
bluebanboom / gist:4273648
Created December 13, 2012 02:55
System Versioning Preprocessor Macros
/*
* System Versioning Preprocessor Macros
*/
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
@bluebanboom
bluebanboom / ReadPlist.m
Created December 8, 2012 06:03
Read Plist.
#import <Foundation/Foundation.h>
CFPropertyListRef CreateMyPropertyListFromFile(CFURLRef fileURL)
{
CFPropertyListRef propertyList;
CFStringRef errorString;
CFDataRef resourceData;
Boolean status;
SInt32 errorCode;