Skip to content

Instantly share code, notes, and snippets.

View bgnori's full-sized avatar

Noriyuki Hosaka bgnori

  • Itabashi, Tokyo, Japan
View GitHub Profile
@bgnori
bgnori / 0041.c
Created May 22, 2012 18:59
AOJ 0041
/* AOJ 0041
*
* http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0041
*
*/
#include <stdio.h>
#include <assert.h>
@bgnori
bgnori / binary.c
Created May 23, 2012 01:16
perfect hash for binary tree. Catalan Number.
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
int fact(int n){
int r, i;
r = 1;
for(i=1;i<=n;i++){
r *=i;
}
@bgnori
bgnori / 0043.c
Created May 23, 2012 14:44
AOJ 0043
/* AOJ 0043
*
* http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0043
*
*/
#include <stdio.h>
#include <memory.h>
#include <assert.h>
(defn place-blocks-in-circle
[world center inner outer place-fn]
; with fill. naive way.
(map
(fn [d]
(prn d);
;(place-fn d 0))
d
)
(blocks-in-radiaus-xz world center inner outer)
(defn blocks-in-radiaus-xz
[world center inner outer]
(let [center-block (.getBlockAt world center)
grided-cetner-location (.getLocation center-block)
grided-cetner-vector (.toVector grided-cetner-location)
ux (Vector. 1.0 0.0 0.0)
uy (Vector. 0.0 1.0 0.0)
uz (Vector. 0.0 0.0 1.0)
inner-diameter (* 2 (Math/floor inner))
outer-diameter (* 2 (Math/ceil outer))
[nori@akagi]~/Desktop/work/cloft/cloft% git diff
diff --git a/src/cloft/core.clj b/src/cloft/core.clj
index c25f160..ca89272 100644
--- a/src/cloft/core.clj
+++ b/src/cloft/core.clj
@@ -80,6 +80,12 @@
(swap! cloft-schedule-table assoc wake-up
(cons f (@cloft-schedule-table wake-up []))))))
+(defn cloft-schedule-while [f]
18:09:51 [WARNING] Task of 'cloft' generated an exception
clojure.lang.ArityException: Wrong number of args (0) passed to: core$entity-shoot-bow-event$fn
at clojure.lang.AFn.throwArity(AFn.java:437)
at clojure.lang.AFn.invoke(AFn.java:35)
at cloft.core$cloft_schedule_while$fn__2108.invoke(core.clj:86)
at cloft.core$cloft_scheduler$fn__2111.invoke(core.clj:96)
at clojure.lang.AFn.call(AFn.java:18)
at clojure.lang.LockingTransaction.run(LockingTransaction.java:263)
at clojure.lang.LockingTransaction.runInTransaction(LockingTransaction.java:231)
at cloft.core$cloft_scheduler.invoke(core.clj:90)
@bgnori
bgnori / sample.json
Created June 26, 2012 07:12
tumblr api
{
u'blog': {
u'ask_anon': False, u'updated': 1340441846, u'description': u'', u'title': u"nori's tumblr", u'url': u'http://bgnori.tumblr.com/', u'posts': 59760, u'ask': True, u'name': u'bgnori'}
, u'total_posts': 59760, u'posts': [{
u'highlighted': [], u'reblog_key': u'W2wZ6hBq', u'format': u'html', u'timestamp': 1340441846, u'note_count': 11, u'tags': [], u'photos': [{
u'caption': u'', u'original_size': {
u'url': u'http://24.media.tumblr.com/tumblr_m624jokw981qz4evpo1_1280.jpg', u'width': 1280, u'height': 960}
, u'alt_sizes': [{
u'url': u'http://24.media.tumblr.com/tumblr_m624jokw981qz4evpo1_1280.jpg', u'width': 1280, u'height': 960}
, {
@bgnori
bgnori / hoge.scala
Created July 16, 2012 00:36
get with apache components
import org.apache.http.client.methods.HttpGet
import org.apache.http.impl.client.DefaultHttpClient
import org.apache.http.HttpResponse
import org.apache.http.HttpStatus
package something {
object ika {
val client = new DefaultHttpClient
def do_post(u: String): Unit = {
「あるプログラミング言語を一通り触る」という目標を達成するのに必要な課題の集合はなにか?
"Hellow World"
まずはこれ
標準出力、実行環境
"fizzbuzz"
if文, mod