Skip to content

Instantly share code, notes, and snippets.

@bumaociyuan
bumaociyuan / gist:1cbe45a3fcf392e1e054
Created Oct 17, 2014
apple script get the front window path
View gist:1cbe45a3fcf392e1e054
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
View auto create blog template
#! /bin/bash
#cd current path
cd `dirname $0`
#get post name
postName=$1
#split post name with '-'
array=(${postName//,/})
@bumaociyuan
bumaociyuan / rename
Created Oct 25, 2014
rename files extension
View rename
#! /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 Aug 29, 2015 — forked from palimondo/gist:5998280
Concise Auto Layout macros
View gist:b6fe9ac3378395e28c88
#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 Aug 31, 2015
Simply install ss on debian
View debian_shadowsocks.sh
#! /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 Sep 23, 2015 — forked from einthusan/go1.4arc65-ubuntu.sh
Install Golang 1.4.1 on Ubuntu 14.04 AWS EC2
View go1.4arc65-ubuntu.sh
#!/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 Jan 23, 2016
设备忙的解决办法
View resolve.md

这时使用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 Jan 27, 2016
ignore karabiner in xcode
View private.xml
<?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 Feb 19, 2016 — forked from sekati/xcode-build-bump.sh
Xcode Auto-increment Build & Version Numbers
View xcode-build-bump.sh
# 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 Feb 19, 2016 — forked from elmodos/revision.sh
Xcode build number Git revision number
View revision.sh
# 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