Skip to content

Instantly share code, notes, and snippets.

@bumaociyuan
bumaociyuan / gist:1cbe45a3fcf392e1e054
Created October 17, 2014 06:12
apple script get the front window path
tell application "Finder"
set myWin to window 1
set theWin to (quoted form of POSIX path of (target of myWin as alias))
tell application "Terminal"
activate
tell window 1
do script "cd " & theWin
-- do script "cd " & theWin & ";ls -al | more"
end tell
end tell
@bumaociyuan
bumaociyuan / auto create blog template
Created October 25, 2014 16:58
自动生成blog 模板
#! /bin/bash
#cd current path
cd `dirname $0`
#get post name
postName=$1
#split post name with '-'
array=(${postName//,/})
@bumaociyuan
bumaociyuan / rename
Created October 25, 2014 16:58
rename files extension
#! /bin/bash
cd `dirname $0`
files=$(find . -name *markdown)
echo $files
for file in { $files }
do
echo $file
fileWithoutUnderbar=${file%markdown}
@bumaociyuan
bumaociyuan / gist:b6fe9ac3378395e28c88
Last active August 29, 2015 14:26 — forked from palimondo/gist:5998280
Concise Auto Layout macros
#define Left NSLayoutAttributeLeft
#define Right NSLayoutAttributeRight
#define Top NSLayoutAttributeTop
#define Bottom NSLayoutAttributeBottom
#define Leading NSLayoutAttributeLeading
#define Trailing NSLayoutAttributeTrailing
#define Width NSLayoutAttributeWidth
#define Height NSLayoutAttributeHeight
#define CenterX NSLayoutAttributeCenterX
#define CenterY NSLayoutAttributeCenterY
@bumaociyuan
bumaociyuan / debian_shadowsocks.sh
Created August 31, 2015 01:11
Simply install ss on debian
#! /bin/bash
#===============================================================================================
# System Required: Debian or Ubuntu (32bit/64bit)
# Description: Install Shadowsocks(libev) for Debian or Ubuntu
# Author: tennfy <admin@tennfy.com>
# Intro: http://www.tennfy.com
#===============================================================================================
clear
echo "#############################################################"
@bumaociyuan
bumaociyuan / go1.4arc65-ubuntu.sh
Last active September 23, 2015 08:02 — forked from einthusan/go1.4arc65-ubuntu.sh
Install Golang 1.4.1 on Ubuntu 14.04 AWS EC2
#!/bin/sh
# OPTIONAL FLAGS:
#
# -geoip true
# this will install maxmind geoip and auto update crontab file
#
# -cloudwatch true
# this will install aws cloud watch metrics and send them to aws dashboard
#
@bumaociyuan
bumaociyuan / resolve.md
Last active January 23, 2016 07:29
设备忙的解决办法

这时使用umount 命令,会提示设备忙,无法挂载。

处理方法: Linux umount 报 device is busy 的处理方法

[root@qs-wg-db1 ~]# fuser -km /datatmp
[root@qs-wg-db1 ~]# df -lh

Filesystem            Size  Used Avail Use% Mounted on
/dev/sdb3 125G 3.3G 115G 3% /
@bumaociyuan
bumaociyuan / private.xml
Created January 27, 2016 07:53
ignore karabiner in xcode
<?xml version="1.0"?>
<root>
<replacementdef>
<replacementname>EMACS_MODE_IGNORE_APPS</replacementname>
<replacementvalue>
EMACS,
TERMINAL,
VI,
XCODE,
</replacementvalue>
@bumaociyuan
bumaociyuan / xcode-build-bump.sh
Created February 19, 2016 02:21 — forked from sekati/xcode-build-bump.sh
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@bumaociyuan
bumaociyuan / revision.sh
Last active February 19, 2016 02:55 — forked from elmodos/revision.sh
Xcode build number Git revision number
# get GIT revision number
buildNumber=`git rev-list --count HEAD`
# write build number
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${buildNumber}" "${INFOPLIST_FILE}"
# if [ "$CONFIGURATION" == "Release" ]; then
# # version number like this V0.20160109.004