Skip to content

Instantly share code, notes, and snippets.

tell application "Address Book"
repeat with this_person in every person
if exists (phone of this_person) then
repeat with this_phone in phones of this_person
set temp to value of this_phone
if the length of temp is equal to 12 and the character 1 of temp is equal to "1" then
set value of this_phone to "+86" & temp
end if
if the length of temp is equal to 6 then
set label of this_phone to "short"
@tianyicui
tianyicui / gist:657543
Created November 1, 2010 03:13
brew install -v ocaml
$ brew install -v ocaml
==> Build Environment
CC: /usr/bin/cc => /usr/bin/gcc-4.2
CXX: /usr/bin/c++ => /usr/bin/c++-4.2
LD: /usr/bin/cc => /usr/bin/gcc-4.2
CFLAGS: -O3 -march=core2 -msse4.1 -w -pipe
CXXFLAGS: -O3 -march=core2 -msse4.1 -w -pipe
MAKEFLAGS: -j2
==> Downloading http://caml.inria.fr/pub/distrib/ocaml-3.12/ocaml-3.12.0.tar.bz2
File already downloaded and cached to /Users/tianyi/Library/Caches/Homebrew
$ brew install -vd mit-scheme
==> Build Environment
CC: /usr/bin/cc => /usr/bin/gcc-4.2
CXX: /usr/bin/c++ => /usr/bin/c++-4.2
LD: /usr/bin/cc => /usr/bin/gcc-4.2
CFLAGS: -O3 -march=core2 -msse4.1 -w -pipe
CXXFLAGS: -O3 -march=core2 -msse4.1 -w -pipe
MAKEFLAGS: -j2
==> Downloading http://ftp.gnu.org/gnu/mit-scheme/stable.pkg/9.0.1/mit-scheme-c-9.0.1.tar.gz
curl -f#LA Homebrew 0.7.1 (Ruby 1.8.7-174; Mac OS X 10.6.4) http://ftp.gnu.org/gnu/mit-scheme/stable.pkg/9.0.1/mit-scheme-c-9.0.1.tar.gz -o /Users/tianyi/Library/Caches/Homebrew/mit-scheme-9.0.1.tar.gz
@tianyicui
tianyicui / port -y install git
Created November 13, 2010 20:15
This is why MacPorts sucks...
port -y install git-core
---> Computing dependencies for git-core
---> Dependencies to be installed: curl curl-ca-bundle perl5 perl5.8 libidn gettext expat libiconv gperf ncurses ncursesw openssl zlib pkgconfig p5-error python26 bzip2 db46 gdbm readline sqlite3 rsync popt
For perl5.8: skipping org.macports.main (dry run)
For perl5: skipping org.macports.main (dry run)
For curl-ca-bundle: skipping org.macports.main (dry run)
For expat: skipping org.macports.main (dry run)
For gperf: skipping org.macports.main (dry run)
For libiconv: skipping org.macports.main (dry run)
For ncursesw: skipping org.macports.main (dry run)
@tianyicui
tianyicui / gist:704767
Created November 18, 2010 08:18
cabal install network-bytestring --verbose=3 failed on MacOSX10.6
$ cabal install network-bytestring --verbose=3
searching for ghc in path.
found ghc at /usr/local/bin/ghc
("/usr/local/bin/ghc",["--numeric-version"])
/usr/local/bin/ghc is version 6.12.3
looking for package tool: ghc-pkg near compiler in /usr/local/bin
found package tool in /usr/local/bin/ghc-pkg
("/usr/local/bin/ghc-pkg",["--version"])
/usr/local/bin/ghc-pkg is version 6.12.3
("/usr/local/bin/ghc",["--supported-languages"])
@tianyicui
tianyicui / gist:704827
Created November 18, 2010 10:09
output of /usr/local/bin/ghc-pkg dump --global -v2
using cache: /Users/tianyi/.ghc/i386-darwin-6.12.3/package.conf.d/package.cache
using cache: /usr/local/Cellar/ghc/6.12.3/lib/ghc/package.conf.d/package.cache
name: Cabal
version: 1.8.0.6
id: Cabal-1.8.0.6-ec9be469687b5a514f4b7e8e2b8343c7
license: BSD3
copyright: 2003-2006, Isaac Jones
2005-2009, Duncan Coutts
maintainer: cabal-devel@haskell.org
We couldn’t find that file to show.
@tianyicui
tianyicui / gist:705043
Created November 18, 2010 14:34
nix test failed
./configure && make && make check
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... x86_64-apple-darwin10.5.0
checking host system type... x86_64-apple-darwin10.5.0
checking for the canonical Nix system name... i686-darwin
checking for gcc... gcc
~/projects/jruby ➔ cat test.rb
#!/usr/bin/ruby
puts ARGV.inspect
~/projects/jruby ➔ ./test.rb "a" 'b' c
["a", "b", "c"]
(I hope this can help you understand.)
#include <string.h>
void gao(char *src, char *dst, int count) {
memcpy(dst, src, count);
}