Skip to content

Instantly share code, notes, and snippets.

View yaraki's full-sized avatar
🏠
Working from home

Yuichi Araki yaraki

🏠
Working from home
View GitHub Profile
@yaraki
yaraki / pi.lisp
Created January 22, 2014 14:08
Ramanujan's formulas of pi in Common Lisp
(defun fact (n)
(let ((r 1))
(loop
for i from 2 to n
do (setf r (* i r))
finally (return r))))
(defun calc-pi-1 (max)
(/ 1
(* (/ (* 2 (sqrt 2.0d0)) (expt 99 2))
@yaraki
yaraki / pi.go
Created January 21, 2014 12:22
Ramanujan's formulas of pi in Go
package main
import (
"fmt"
"math"
)
func fact(n float64) float64 {
r := float64(1)
for 1 < n {
@yaraki
yaraki / mrex.py
Created December 21, 2013 16:59
Simplest MonkeyRunner script that keeps on tapping the specified position every second
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
device = MonkeyRunner.waitForConnection()
while 1:
device.touch(540, 1560, MonkeyDevice.DOWN_AND_UP)
MonkeyRunner.sleep(1.0)
@yaraki
yaraki / andr
Last active December 22, 2015 01:39
A simple Ruby script for preparing resized drawable images for multiple DPIs on Android.
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Yuichi Araki
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@yaraki
yaraki / dijkstra.rb
Created February 3, 2012 13:58
Dijkstra Shortest Path Algorithm in Ruby
#!/usr/bin/ruby1.9.1 -Kw
# -*- coding: utf-8 -*-
class Edge
attr_accessor :src, :dst, :length
def initialize(src, dst, length = 1)
@src = src
@dst = dst
@length = length