Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <oauth.h>
int main(int argc, char **argv)
{
char *consumer_key = "*********************";
char *consumer_secret = "******************************************";
char *access_token = "********-*****************************************";
#include <iostream>
using namespace std;
namespace vtstring {
// 文字列を表す可変引数テンプレート
template <char... a> struct vtstring;
template <char a, char... b>
struct vtstring<a, b...>
{
require 'oauth'
request = OAuth::RequestProxy.proxy(
"method" => 'GET',
"uri" => 'https://betastream.twitter.com/2b/user.json',
"parameters" => {
"oauth_consumer_key" => "******************",
"oauth_token" => "***-******************",
"oauth_nonce" => OAuth::Helper.generate_key,
"oauth_timestamp" => OAuth::Helper.generate_timestamp,
@NeoCat
NeoCat / chirp.js
Created September 25, 2010 05:40
Streaming API plugin and proxy server for twicli
var chirp_cnt = 0;
function update() {
if (!myname) return auth();
callPlugins("update");
if (chirp_cnt++ == 0)
update_ele = loadXDomainScript(twitterAPI + 'statuses/home_timeline.json' +
'?count=' + (since_id ? 200 : max_count) +
'&suppress_response_codes=true&callback=twShow', update_ele);
else
update_ele = loadXDomainScript('http://localhost:10080/?seq='+ (seq++) +
@NeoCat
NeoCat / tweet_URL_with_twicli.js
Created October 9, 2010 01:52
Open twicli and input tweet with current URL and title
javascript:void(window.open('http://twicli.neocat.jp/twicli.html?status="'+encodeURIComponent(document.title)+'":%20'+location.href,'twicli'))
#!/usr/bin/ruby
require 'pty'
Signal.trap(:CHLD, 'IGNORE')
system "stty raw -echo 2> /dev/null"
p = PTY.spawn '/bin/sh'
until p[0].closed? || STDIN.closed?
s = IO.select [p[0], STDIN]
@NeoCat
NeoCat / test.html
Created February 6, 2011 12:29
Test for double onload of iframe in Opera with oAutoPagerize.js
<html>
<head>
<script>
function test() {
var ifr = document.createElement("iframe");
document.body.appendChild(ifr);
ifr.onload = function(){ document.getElementById("log").innerHTML += "onload " }
ifr.contentWindow.document.write('');
ifr.contentWindow.document.close();
};
@NeoCat
NeoCat / toptracks.html
Created March 9, 2011 11:45
get toptracks of artist using last.fm API
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>last.fm API test</title>
<script>
var api_key = '0809689c938abf942a0d980ff25b5689';
var api_url = "http://ws.audioscrobbler.com/2.0/?method=artist.gettoptracks&api_key="+api_key+"&format=json&autocorrect=1&artist=";
function $(id) { return document.getElementById(id); }
@NeoCat
NeoCat / share-input.rb
Created April 29, 2011 21:13
Share input within multiple terminals
#!/usr/bin/ruby
# share-input.rb: share input within multiple terminals
# Author: NeoCat
require 'socket'
require 'pty'
require "thread"
require "curses"
def server(sock, sock_name)
puts "relay server started."
@NeoCat
NeoCat / Bookmarklet.js
Created May 15, 2011 09:06
Send 'Chrome to Phone' request usig CGI and bookmarklet
javascript:window.open('http://localhost/utils/chrome2phone.cgi?title='+encodeURIComponent(document.title)+'&url='+encodeURIComponent(location.href),%20'_blank',%20'width=200,height=100');undefined;