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 / jxaClickAppSubMenuItem.applescript
Last active Dec 2, 2020 — forked from RobTrew/jxaClickAppSubMenuItem.applescript
Yosemite JXA Javascript Function for clicking application sub-menu items
View jxaClickAppSubMenuItem.applescript
// Click an OS X app sub-menu item
// 2nd argument is an array of arbitrary length (exact menu item labels, giving full path)
// e.g. menuItemClick("InqScribe", ['View', 'Aspect Ratio', 'Use Media Ratio'])
// Note that the menu path (spelling & sequence) must be exactly as in the app
// See menuItemTestClick() below for a slower version which reports any errors
// For OS X 10.10 Yosemite JXA JavaScript for Automation
@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 / gist.md
Last active Jun 4, 2017
Stuck on `Authenticating with the App Store...`
View gist.md
@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>