Skip to content

Instantly share code, notes, and snippets.

View ryuone's full-sized avatar

Ryuichi Maeno ryuone

View GitHub Profile

Keybase proof

I hereby claim:

  • I am ryuone on github.
  • I am ryuone (https://keybase.io/ryuone) on keybase.
  • I have a public key ASB6CHJcIbZrc_ua0XmOc6trs5DzSp0gC-0jOwSXtpm-dQo

To claim this, I am signing this object:

<?php
// https://www.w3.org/TR/CSP2/
//header("Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'");
//header("Content-Security-Policy: default-src 'self'; script-src 'self'");
//header("Content-Security-Policy: script-src 'self' 'unsafe-inline'");
header("Content-Security-Policy: default-src 'none'; base-uri 'self'; child-src 'self'; form-action 'self'; script-src 'self' 'unsafe-inline'");
/* Post HTML data.
<input type='button' onClick='console.log("");' value='name'/>
<a onClick='console.log("clicked....");' value='name'/>Click me</a>
@ryuone
ryuone / stupid_dog_fsm.erl
Last active November 29, 2015 14:03
gen_fsm sample(すごいErlangゆかいに学ぼう! 15章)
-module(stupid_dog_fsm).
-author('ryuone<[email protected]>').
-behaviour(gen_fsm).
-export([start_link/0]).
-export([init/1, handle_event/3, handle_sync_event/4, handle_info/3, terminate/3, code_change/4]).
-export([sit/3, bark/3, wag_tail/3]).
-export([get_sync_state/1]).
-export([test/0]).
@ryuone
ryuone / connect_air.sh
Created October 18, 2015 13:31 — forked from j3tm0t0/connect_air.sh
SORACOM Air + FS01BU を、Raspberry Pi や Intel Edison (debianインストール&USB-OTGケーブルで接続) で使用するための接続スクリプト(要: wvdial / usb-modeswitch)
#!/bin/bash
lsusb
# USB modem device information
vendor=1c9e # OMEGA TECHNOLOGY
product=6801 # 3G(FS01BU)
tty=/dev/ttyUSB2
init_modem()
{
@ryuone
ryuone / AES.c
Created October 13, 2015 13:02 — forked from bricef/AES.c
A simple example of using AES encryption in Java and C.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* MCrypt API available online:
* http://linux.die.net/man/3/mcrypt
*/
#include <mcrypt.h>
-module(main).
-export([main/0, main/1]).
main() ->
main([""]).
main([_]) ->
{N, Nv, M} = read_line(),
Parent = self(),
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define :node1 do |node|
node.vm.box = "ubuntu-14.04"
'use strict'
module.exports = (grunt) ->
require('time-grunt')(grunt)
require('load-grunt-tasks')(grunt)
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
jshint:
all: ['src/**/*.js']
ExUnit.start
# defprotocol Comparable do
# @only [BitString]
# def be(left,right)
# def le(left,right)
# def left <= right
# end
# defimpl Comparable, for: BitString do
// this function opens the websocket and will trigger add_point when
// a new message is received
Stream = function () {
_.extend(this, Backbone.Events);
var self = this;
self.socket = new WebSocket("ws://" + document.domain + ":5000/websocket");
console.log("Using a standard websocket");
self.socket.onopen = function(e) {