Skip to content

Instantly share code, notes, and snippets.

View geta6's full-sized avatar

geta6 geta6

View GitHub Profile
@geta6
geta6 / Collision.js
Created October 21, 2011 09:21
Collision
var smokePrefab : GameObject;
function OnCollisionEnter(collisionInfo : Collision) {
if (collisionInfo.gameObject.tag == "Box") {
collisionInfo.gameObject.SendMessage("ApplyDamage");
}
Instantiate(smokePrefab, transform.position, transform.rotation);
Destroy(gameObject);
}
@geta6
geta6 / installshairport.sh
Created November 13, 2011 14:36
install shairport for linux
#!/bin/sh
if [ ! "$EUID" = "0" ] ; then
echo "need sudo" 1>&2
exit 1
fi
apt-get install libcrypt-openssl-rsa-perl libio-socket-inet6-perl libao-dev avahi-utils avahi-discover avahi-daemon libnss-mdns mdns-scan
service avahi-daemon start
perl -MCPAN -e 'install Crypt::OpenSSL::RSA'
@geta6
geta6 / install_tsocks.sh
Created December 1, 2011 07:19
brew and tsocks installer
#!/bin/bash
accept() {
RAW='FALSE'
while getopts r: opt
do
case $opt in
r) RAW='TRUE' ;;
esac
done
@geta6
geta6 / killterm.zshrc
Created December 4, 2011 03:19
ウィンドウが単一のときterminal.appをkillします、bashでも動きます
#!/bin/zsh
alias quit=killterm
killterm(){
_WIN=$(( `w | wc -l`-3 ))
_PID=`ps ax | grep Terminal | grep -v grep | sed -e 's/ *\([0-9]*\).*/\1/g'`
[[ -z ${WINDOW} ]] && [[ 1 -eq ${_WIN} ]] && [[ -n ${_PID} ]] && kill ${_PID}
exit
}
@geta6
geta6 / generate_identifier.php
Created December 26, 2011 12:00
日本語/英語から任意文字数の識別子を生成します
#!/usr/bin/php
<?php
// 辞書
$dicts = array(
array('jp'=>'英単語', 'en'=>'English Words'),
);
// 生成する識別子の文字数
$n = 4;
@geta6
geta6 / ProcStat.class.php
Created December 26, 2011 12:04
Linux(ubuntu以外で試してない)でexec使いまくってCPUとかMEMとかファン回転数とかPCの状態を配列で返すphpのクラス
<?php
class ProcStat{
function upt($f=null){
exec('cat /proc/uptime', $e);
preg_match('/(.*) (.*)/', $e[0], $e);
if(is_null($f)){
return sprintf('%.0f', $e[1]);
} else {
@geta6
geta6 / localefix.sh
Created December 27, 2011 09:55
ubuntuでperlのLCナントカエラーが起きる時の日本語ロケールfixスクリプト
#/bin/sh
echo ja_JP.UTF-8 UTF-8 >> /var/lib/locales/supported.d/local
locale-gen
dpkg-reconfigure locales
@geta6
geta6 / imagetopdf.zsh
Created February 23, 2012 01:05
summarized consecutive images at current directory to one PDF
#!/bin/zsh
require=false
[[ ! -f `which pdftk` ]] && echo 'Require Package pdftk' && require=true
[[ ! -f `which convert` ]] && echo 'Require Package convert (ImageMagick)' && require=true
if [[ $require == true ]] ; then
exit
fi
@geta6
geta6 / a.sh
Created April 28, 2012 15:06
count 'a' in $s
s="abracadabra" ; s=(${(s:a:)s}) ; echo $(($#s[*]+1))
@geta6
geta6 / o.js
Created May 6, 2012 10:50
RangeError: Maximum call stack size exceeded.
(function o(){o()}())