Skip to content

Instantly share code, notes, and snippets.

@ha1t
ha1t / powersave.sh
Created April 18, 2012 01:13
laptop pcを運用していた時のスクリプト
#!/bin/sh
#cd-romドライブの自動認識をoffに
sudo hal-disable-polling --device /dev/scd0
#遅延書き込みを5秒から15秒へ
#sudo echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
#無線の省電力モードを有効に
sudo iwpriv eth1 set_power 5
@ha1t
ha1t / visitors.php
Created April 18, 2012 01:17
visitors使ってたなー
<?php
/**
* visitorsでログを作るスクリプト
*
* need nkf,visitors,apache2
*/
error_reporting(E_ALL);
ini_set('display_errors', 'On');
/**
@ha1t
ha1t / make_svn_repository.sh
Created April 20, 2012 09:51
Subversionリポジトリ作るやつ。もうSubversionとか使ってない…
#!/bin/sh
if [ -z $1 ]; then
echo "Usage:$0 [project_name]"
exit
fi
base_dir="/var/lib/svn"
target_dir=$base_dir/$1
@ha1t
ha1t / phppro_quote_count.php
Created April 20, 2012 09:54
PHPプロ!のnewsが何回他のニュースサイトから引用しているかチェックするスクリプトとか書いたなー
<?php
/**
* PHPプロ!のnewsで何回他のニュースサイトから
* 引用しているかチェックするスクリプト
*
*/
require_once 'HTTP/Client.php';
$g_target_url = 'http://www.phppro.jp/news/';
$g_start = 215;
@ha1t
ha1t / name.php
Created April 26, 2012 01:07
nameの文字列がaを何回インクリメントすると表現できるかしらべるものっぽい
<?php
/**
* nameの文字列がaを何回インクリメントすると表現できるかしらべるものっぽい
*/
ini_set('max_execution_time', 5);
if ( !isset($_POST['name']) ) {
$str = <<<EOD
<form method="post">
@ha1t
ha1t / str_replace_files.php
Created April 26, 2012 01:14
[いにしえのスクリプト]指定されたディレクトリの中全部のファイルの内容にたいしてstr_replaceするスクリプトっぽい!
#!/usr/bin/env php
<?php
/**
* replace_files
*
* @example replace_files.php before after *
*/
if ($argc < 4) {
@ha1t
ha1t / gist:2879251
Created June 6, 2012 01:19
Windowsっぽい感じにvimを使うためのvim script
" Shift + 矢印で visual modeがはじまる
nnoremap <S-Up> v<Up>
nnoremap <S-Down> v<Down>
nnoremap <S-Left> v<Left>
nnoremap <S-Right> v<Right>
" visual mode 中のShift + 矢印は範囲選択
vnoremap <S-Up> k
vnoremap <S-Down> j
vnoremap <S-Left> h
@ha1t
ha1t / gist:3748019
Created September 19, 2012 06:32 — forked from karlseguin/gist:1876859
sublime text 2 script to save to remove server
#variation of http://urbangiraffe.com/2011/08/13/remote-editing-with-sublime-text-2/ that adds creating new folders remotely.
import sublime_plugin, os
class RemoteEdit(sublime_plugin.EventListener):
def on_post_save(self, view):
remote = { "/Users/leto/work/project": ["/usr/bin/scp", None, "user@server", "root_remote_path_like ~/project/", None] }
for dirname, target in remote.iteritems():
if view.file_name().startswith( dirname ):
@ha1t
ha1t / entries2.json
Created November 3, 2012 04:02 — forked from yandod/entries2.json
Plugin Catalog for CandyCane
{
"cc_nyancat":{
"id":"cc_nyancat",
"name":"Nyan down chart rocks!",
"description":"This is demonstration of plugin system.",
"url":"https:\/\/github.com\/downloads\/yandod\/cc_nyancat\/cc_nyancat-v0.3.1.zip",
"author":"yandod",
"author_url":"https:\/\/github.com\/yandod",
"version":"0.3.1"
},
@ha1t
ha1t / vote.php
Created November 4, 2012 02:20
PHPMatsuri 2012 投票サポートシステム
<?php
$url = 'https://docs.google.com/spreadsheet/viewform?formkey=dHlaWTV5U0xvVWdaZ0lNNkNIQ1dkeXc6MA';
$names = array(
'halt',
'yando',
'takahashiyuya',
'tanakahisateru',
'shin1x1',
'remore',