Skip to content

Instantly share code, notes, and snippets.

@halka
halka / gist:91714
Created April 8, 2009 10:28
twitter updates viewing from windows command prompt
<?php
$user=NULL;
while(1){
echo "command exit -> :q\n";
echo 'username : ';
$fp=fopen("php://stdin","r");
$user=trim(fgets($fp,64));
fclose($fp);
if($user===':q') break;
echo "20*n n=";
@halka
halka / gist:91717
Created April 8, 2009 10:31
bookmarklet, when u r watchin' friend's profile on mixi, jump to friend's mixi echo list page
//when u r watchin' friend profile on mixi, jump to friend's mixi echo list page
var id=window.location.href.replace('http://mixi.jp/show_friend.pl?id=','');
window.location.href='http://mixi.jp/list_echo.pl?id='+id;
@halka
halka / gist:91720
Created April 8, 2009 10:40
convert strings status for VatsimPHP
<?php
//fucntion library for VatsimPHP
class vatsimtool{
//integer to rating string
function rating($i){
switch($i){
case 1: return "Pilot/Observer"; break;
case 2: return "Student "; break;
case 3;
case 4: return "Senior Student"; break;
@halka
halka / gist:91724
Created April 8, 2009 11:18
delete my post from twitter.require 'Rubytter''
#-*- encoding: UTF-8 -*-
require 'rubytter'
id='twitter_id'
pass='twitter_password'
rubytter=Rubytter.new(id,pass)
puts 'input status id, you wanna delete.'
print 'status id = '
statusid=gets.chomp
rubytter.remove_status(statusid)
@halka
halka / gist:92444
Created April 9, 2009 12:49
downloading user's log from twitter.
<?php
//how 2 use
//only working on console.
//ex) $php5 filename.php username n
//n of count of post 20*n
//u can get user's post.
$user=$argv[1];
$count=$argv[2];
@halka
halka / gist:93479
Created April 11, 2009 06:21
DOS窓から好きなユーザのログをがしがし取る
<?php
$user=$argv[1];
$count=$argv[2];
$got=0;
$f=false;
for($i=1;$i<=$count;$i++){
$url="http://twitter.com/statuses/user_timeline/$user.json?page=$i";
$file=@file_get_contents($url);
if($file){
$temp=json_decode($file,true);
@halka
halka / gist:105438
Created May 2, 2009 06:15
TwitterのAPIの残機を取得する
<?php
//TwitterのAPIの残機を取得する
require_once 'HTTP/Request.php';
define('user','userid');
define('pass','password');
$apilim='http://twitter.com/account/rate_limit_status.json';
$req=& new HTTP_Request($apilim);
$req->setBasicAuth(user,pass);
$req->sendRequest();
$result=$req->getResponseBody();
'hourly_limit' => int 100
'reset_time' => string 'Sat May 02 06:58:23 +0000 2009' (length=30)
'reset_time_in_seconds' => int 1241247503
'remaining_hits' => int 95
@halka
halka / gist:105459
Created May 2, 2009 07:45
Vatsimのstatusをserverからgetしてjsonで返します。
<?php
/*
you can get vatsim's online status.
httprequest from another script.
data format : http://www.bbflights.com/VatsimPHP/manual.php
using Vatsimphp by Brian Beach http://www.bbflights.com/VatsimPHP/
*/
require_once 'VatsimPHPgenerator.php';
$vsg=& new VatsimPHP;
@halka
halka / gist:105464
Created May 2, 2009 08:03
jsonをdecodeしてコールサイン一覧を表示
<?php
require_once 'HTTP/Request.php';
$url='http://exp.rw12.net/vatsim_new/gen_json.php';
$req=& new HTTP_Request($url);
$req->sendRequest();
$res=$req->getResponseBody();
$decoded=json_decode($res,true);
//list of online
echo "<ul>\n";
foreach($decoded as $data){