Skip to content

Instantly share code, notes, and snippets.

@kikaigyo
kikaigyo / gist:4180289
Created December 1, 2012 02:37
hosts
# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file, as long the original
# URL is included. See below for acknowledgements.
# Please forward any additions, corrections or comments by email to
# hosts@someonewhocares.org
# Last updated: Nov 30th, 2012 at 00:01
# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file, as long the original
# URL is included. See below for acknowledgements.
# Please forward any additions, corrections or comments by email to
# hosts@someonewhocares.org
# Last updated: Nov 30th, 2012 at 00:01
@kikaigyo
kikaigyo / gist:4134754
Created November 23, 2012 09:34
"情報を見る"をターミナルから開くスクリプト
#!/bin/sh
# This script opens the Finder's "Get Info" window
# for the file or folder specified as a command-line argument.
# http://tukaikta.blog135.fc2.com/blog-entry-240.html
scriptname=`basename $0`
if [ $# -lt 1 ]; then
echo "Usage: $scriptname file_or_folder"
exit
@kikaigyo
kikaigyo / gist:3937675
Created October 23, 2012 08:44
Automataのサービスで使う検索用のアレ
#Web検索
open "https://www.google.co.jp/search?hl=ja&qscrl=1&q=$@"
open "http://www.google.com/search?q=$(cat | ruby -e 'require "cgi"; print CGI.escape($<.read.chomp)')"
# news検索
open "https://google.co.jp/search?hl=ja&gl=jp&tbm=nws&q=$@"
@kikaigyo
kikaigyo / gist:3931965
Created October 22, 2012 15:14
シンボリックリンクを作成するAppleスクリプト。Automataのサービスでつかう。
on run {input, parameters}
(* Your script goes here *)
tell application "Finder"
set theinput to item 1 of input as alias
set theInfo to info for theinput
set theName to name of theInfo
set inpath to "\"" & (POSIX path of ¬
(theinput)) & "\""
choose folder with prompt "Choose Destination Folder"
set outpath to "\"" & (POSIX path of ¬
@kikaigyo
kikaigyo / gist:3923323
Created October 20, 2012 13:48
起動中のアプリ全てを終了するAppleスクリプト
(*起動中のアプリを全て終了するが、メニューバー常駐のは含まれない*)
tell application "System Events" to set quitapps to name of every application process whose visible is true and name is not "Finder"
repeat with closeall in quitapps
quit application closeall
end repeat
@kikaigyo
kikaigyo / gist:3899495
Created October 16, 2012 14:11
release inactive mem.app use $du command.
--disk usage
(* 10.6までは5〜10秒。10.7以降は20〜25秒 *)
do shell script "du -sx / &> /dev/null & sleep 25 && kill $!"
delay 2
--Finderを再起動
do shell script "killall Finder"
--Menubarを再起動
do shell script "killall SystemUIServer"
@kikaigyo
kikaigyo / gist:3797673
Created September 28, 2012 02:49
purge_ja
#!/bin/bash
# This script checks the available inactive memory.
# Memory is purged if the available number of MB is
# greater than the following "msize" variable. Attach
# this script to launchd to run it periodically.
msize=1200
MM=`vm_stat | awk '/Pages\ inactive\:/ {print int($3/256)}'`
@kikaigyo
kikaigyo / gist:3796683
Created September 27, 2012 21:54
リミッターつきpurge.
#!/bin/bash
# This script checks the available inactive memory.
# Memory is purged if the available number of MB is
# greater than the following "msize" variable. Attach
# this script to launchd to run it periodically.
msize=1200
MM=`vm_stat | awk '/Pages\ inactive\:/ {print int($3/256)}'`
@kikaigyo
kikaigyo / gitweb.conf
Created April 15, 2012 04:21
Macで使っているgitweb.conf
# Gitサーバーのパス。
$projectroot = "/Users/kikaigyo/git";
# tmpのパス。
$git_temp = "/tmp";
# target of the home link on top of all pages
#$home_link = $my_uri || "/";
# html text to include at home page