Skip to content

Instantly share code, notes, and snippets.

View ryuone's full-sized avatar

Ryuichi Maeno ryuone

View GitHub Profile
@shinout
shinout / to_kana_zenkaku.js
Last active December 25, 2020 02:15
半角カナを全角カナに変換するJavaScript
/**
* 半角カナを全角カナに変換する
* 半角スペースは変換しない
* 対応がとれない濁点、半濁点は変換しない
*/
function toKanaZenkaku(str) {
// lengthの等しい2つの文字列でkey-valueをつくる
const makeMap = (str1, str2) =>
str1
.split("")
@bricef
bricef / AES.c
Last active May 11, 2024 21:15
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>
@schakko
schakko / glibberish-aes-256-cbc-decrypt.js
Created May 7, 2012 16:11
Using AES-256-CBC with OpenSSL, node.js and PHP
// Doing AES-256-CBC (salted) decryption with node.js.
// This code is based on http://php.net/manual/de/function.openssl-decrypt.php and works with PHP sqAES.
//
// Create your encrypted data with
// echo -n 'Hello world' | openssl aes-256-cbc -a -e
var crypto = require('crypto');
var password = 'password';
var edata = 'U2FsdGVkX18M7K+pELP06c4d5gz7kLM1CcqJBbubW/Q=';
@hiroeorz
hiroeorz / reltool.config
Created June 17, 2012 11:49
Erlangリリースパッケージ生成ツール用設定ファイルのサンプル
{sys, [
{lib_dirs, ["../deps"]}, %% depsを追加
{erts, [{mod_cond, derived}, {app_file, strip}]},
{app_file, strip},
{rel, "hogeapplication", "0.1",
[
%% 標準で使うライブラリも全て追加
kernel,
stdlib,
sasl,
@tiagoa
tiagoa / Backbone.websocket.js
Created October 13, 2012 23:34
Overwrite Backbone.sync method to persist model via WebSocket
// Inspired by https://github.com/logicalparadox/backbone.iobind/blob/master/lib/sync.js
// Overwrite Backbone.sync method
Backbone.sync = function(method, model, options){
// create a connection to the server
var ws = new WebSocket('ws://127.0.0.1:1234');
// send the command in url only if the connection is opened
// command attribute is used in server-side.
ws.onopen = function(){
@voluntas
voluntas / erlang_release.rst
Last active April 7, 2016 13:30
Erlang リリース コトハジメ

Erlang リリース コトハジメ

更新:2014-04-10
バージョン:0.2.1
作者:@voluntas
URL:http://voluntas.github.io/

reltool 周りについて勉強がてらまとめてみました

@m-nori
m-nori / README.md
Created January 16, 2013 16:00
さくらVPSにJenkins入れてGithubのnode.jsをビルドする。

Jenkins上でnode.jsプロジェクトをテスト

さくらVPS上でGithubに入れたnode.jsプロジェクトをJenkins経由でテストする


Javaのインストール

入ってなければ入れる。

@martinnormark
martinnormark / AlertView.js
Created February 7, 2013 10:25
Twitter Bootstrap Alert view for Backbone.js
(function () {
MyApp.AlertView = Backbone.View.extend({
tagName: "div",
className: "alert fade",
template: ["<a href=\"#\" data-dismiss=\"alert\" class=\"close\">&times;</a>", "<strong>{{ title }}</strong>", "{{ message }}"].join("\n"),
@nathan-osman
nathan-osman / CMakeLists.txt
Last active April 2, 2024 21:27
Generates a self-signed x509 certificate using OpenSSL.
# A simple CMake script for building the application.
cmake_minimum_required(VERSION 2.8)
project(create-x509)
# Our only dependency is OpenSSL
find_package(OpenSSL REQUIRED)
include_directories(${OPENSSL_INCLUDE_DIR})
add_executable(create-x509 create-x509.cpp)
@kevsmith
kevsmith / bench.erl
Last active December 14, 2015 07:09
Simple Erlang message passing benchmark
-module(bench).
-export([run_suite/3, run/1]).
run_suite(Name, Passes, Messages) ->
Results = run_suite1(Passes, Messages, []),
Avg = lists:sum(Results) / Passes,
StdDev = math:sqrt(lists:sum([math:pow(X - Avg, 2) || X <- Results]) / Passes),
Summary = [{avg, Avg}, {stddev, StdDev}, {min, lists:min(Results)},
{max, lists:max(Results)}],