Skip to content

Instantly share code, notes, and snippets.

View mayth's full-sized avatar

Mei Akizuru mayth

View GitHub Profile
@mayth
mayth / iTunesCurrentTrack.cs
Created November 24, 2011 23:14
Get Current Track from iTunes
// * Add reference to iTunesLib to your project.
// * If iTunes isn't running when this code run, iTunes will start.
// * After this code run, iTunes will ask you that "are you sure to exit?" when you close iTunes because this code cannot release COM interface. Releasing code is no effects...
using System;
using iTunesLib;
iTunesApp app = new iTunesApp();
IITTrack track = app.CurrentTrack;
if (track != null)
@mayth
mayth / LinearCellularAutomaton.cs
Created December 15, 2011 16:11
Linear Cellular Automaton Class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SimulationPhys2_5
{
/// <summary>
/// Represents a linear cellular automaton.
/// </summary>
@mayth
mayth / GetAreaWithHitmiss.cs
Created December 16, 2011 00:18
Get area of circle (r=1) by HitMiss-method
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SimulationPhys1_2
{
struct Point
{
public double X { get; private set; }
@mayth
mayth / MethodMissingSample.cs
Created December 16, 2011 08:53
Sample for Method-Missing in C# with DynamicObject
using System;
using System.Dynamic;
namespace MethodMissingSample
{
class MethodMissing : DynamicObject
{
Func<object[], string> method;
@mayth
mayth / id2scrn.rb
Created December 29, 2011 18:41
id to screen name and followers
require 'optparse'
require 'twitter'
out_file = ''
opt = OptionParser.new
opt.on('-o output') {|v| out_file = v}
opt.parse!(ARGV)
abort('no source file') if ARGV.size == 0
@mayth
mayth / id2scrn_no-twgem.rb
Created December 29, 2011 18:54
ID to screen name and followers count without twitter gem
require 'optparse'
require 'net/http'
require 'json'
out_file = ''
opt = OptionParser.new
opt.on('-o output') {|v| out_file = v}
opt.parse!(ARGV)
@mayth
mayth / follow_dif.rb
Created January 22, 2012 09:43
Lists the users who B follows but A doesn't follow.
require 'json'
require 'net/http'
def get_followings(screen_name, cursor = '-1')
result = []
if (cursor != '0')
json = JSON.parse(Net::HTTP.get(URI("http://api.twitter.com/1/friends/ids.json?screen_name=#{screen_name}&cursor=#{cursor}")))
result << json['ids']
if json['next_cursor_str']
result << get_followings(screen_name, json['next_cursor_str'])
@mayth
mayth / 5-q2.c
Created February 13, 2012 22:38
Intro to Machine Language/5-2
#include <stdio.h>
int main()
{
printf("%d¥n", fib(5));
return 0;
}
@mayth
mayth / build.log
Created April 26, 2012 02:15
build log for emerging ggz-client-libs-0.0.14.1 and emerge --info
 * Package: dev-games/ggz-client-libs-0.0.14.1
 * Repository: gentoo
 * Maintainer: games@gentoo.org
 * USE: amd64 consolekit elibc_glibc kernel_linux multilib policykit userland_GNU
 * FEATURES: sandbox
>>> Unpacking source...
>>> Unpacking ggz-client-libs-0.0.14.1.tar.gz to /var/tmp/portage/dev-games/ggz-client-libs-0.0.14.1/work
>>> Source unpacked in /var/tmp/portage/dev-games/ggz-client-libs-0.0.14.1/work
>>> Preparing source in /var/tmp/portage/dev-games/ggz-client-libs-0.0.14.1/work/ggz-client-libs-0.0.14.1 ...
* Applying ggz-client-libs-0.0.14.1-destdir.patch ...
@mayth
mayth / NK.cpp
Created May 28, 2012 09:35 — forked from siritori/NK.cpp
ほげほげ (implement with C#)
#include <iostream>
#include <map>
using namespace std;
typedef enum {
IMPLIES,
AND,
OR,
NOT,