Skip to content

Instantly share code, notes, and snippets.

View makotoshimazu's full-sized avatar

Makoto Shimazu makotoshimazu

View GitHub Profile
@makotoshimazu
makotoshimazu / multikey-quicksort.c
Created December 12, 2013 04:38
Multi-key Quick Sort
//! gcc -o multikeyquicksort.bin multikeyquicksort.c -W -Wall -O3 -std=gnu99
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
typedef char * string;
@makotoshimazu
makotoshimazu / heaptree.c
Created December 23, 2013 06:47
Binary Heap
//! gcc -o heaptree.bin heaptree.c -W -Wall -O0 -g -std=gnu99
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef int htree_value_t;
typedef int (*htree_cmp_t)( const htree_value_t *, const htree_value_t *);
@makotoshimazu
makotoshimazu / arenaoverflow.c
Created January 7, 2014 06:15
arenaが思ったとおりに動作しているか確認するためのコード。 2013/12/27時点でcloneしたmrubyでは正常動作しなかったが、#1637のプルリクで1/3に直っている。 この例だとarenaに保護されているようだが、いつ放置されるのかよくわかっていない。
//! make arenaoverflow.bin
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <mruby.h>
#include <mruby/compile.h>
#include <mruby/value.h>
@makotoshimazu
makotoshimazu / kmeans.html
Last active August 29, 2015 13:57
k-means clustering sample
<html>
<head>
<script type="text/javascript" src="kmeans.js"></script>
</head>
<body onload="kmeans.reset()">
<form name="f">
<input type="button" onclick="kmeans.reset()" value="start"><input type="button" value="step" onclick="kmeans.step()"><br/>
<br/>
<canvas id="field" width="1024" height="768"><br/>
</body>
@makotoshimazu
makotoshimazu / hello_syslog.c
Created May 12, 2014 02:39
syslog関数を利用してsyslogにログを吐いてみるテスト。 userのfacilityのログが出るように、(ubuntu14.04では)/etc/rsyslog.d/50-default.confを編集する必要がある。
#include <stdio.h>
#include <syslog.h>
int main(void)
{
printf("Hello World!\n");
openlog("testmsg", LOG_CONS|LOG_PID, LOG_USER);
syslog(LOG_WARNING, "Hello World!\n");
closelog();
printf("syslog is closed\n");
@makotoshimazu
makotoshimazu / led.cpp
Created July 13, 2014 23:58
Blink the LEDs on Beagle Bone Black
#include <fstream>
#include <sstream>
#include <stdexcept>
#include "led.h"
using namespace pile;
using namespace std;
LED::LED(int id)
{
@makotoshimazu
makotoshimazu / XSS.js
Created July 19, 2014 14:51
SECCON XSS
"<input type="button" onclick="document.write('<scrip'+'t>for(i=0;i<1000;i++){alert(¥'X'+'SS¥');}</scrip'+'t>')" value="xxx"/>
@makotoshimazu
makotoshimazu / git-feature
Last active August 29, 2015 14:12
Redmineでチケット番号を入れるのが面倒なのでつくった
#!/bin/bash
#
# git-feature
#
# Author: Makoto Shimazu <makoto.shimaz@gmail.com>
# URL: https://amiq11.tumblr.com
# License: MIT License
# Created: 2015-01-06
#
@makotoshimazu
makotoshimazu / copy_multi_area.cpp
Created February 17, 2015 14:21
Measure throughput of memory
//! g++ -o copy_multi_area copy_multi_area.cpp -W -Wall -std=c++11 -O3 -mavx -funroll-loops
/*
* copy_multi_area.cpp
*
* Author: Makoto Shimazu <makoto.shimaz@gmail.com>
* URL: https://amiq11.tumblr.com
* License: MIT License
* Created: 2015-02-17
*
*/
@makotoshimazu
makotoshimazu / gogs_persistent.patch
Created March 22, 2015 04:20
gogsを簡単に永続化させるためのパッチ
diff --git a/.gitignore b/.gitignore
index ba878d9..265d8fc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,5 +34,6 @@ config.codekit
docker/fig.yml
docker/docker/Dockerfile
docker/docker/init_gogs.sh
+docker/docker/misc/
gogs.sublime-project