Skip to content

Instantly share code, notes, and snippets.

View TakahikoKawasaki's full-sized avatar

Takahiko Kawasaki TakahikoKawasaki

View GitHub Profile
@TakahikoKawasaki
TakahikoKawasaki / namespace.js
Last active August 29, 2015 14:18
Function to define a namespace in JavaScript.
/*
* Copyright (C) 2015 Neo Visionaries Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@TakahikoKawasaki
TakahikoKawasaki / authentication-server-sinatra.rb
Created November 12, 2015 01:23
Authlete Authentication Callback Endpoint Sample in Sinatra
#!/usr/bin/env ruby
#
# Copyright (C) 2014-2015 Authlete, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@TakahikoKawasaki
TakahikoKawasaki / template.sh
Last active December 20, 2015 04:48
Bash script template like C
#!/bin/bash
#--------------------------------------------------
# Global Variables
#--------------------------------------------------
__v_verbose=0
__v_dry_run="false"
@TakahikoKawasaki
TakahikoKawasaki / gist:8156948
Last active January 1, 2016 14:19
Count up letters, bytes in UTF-8 and surrogate pairs in JavaScript
<!DOCTYPE html>
<html>
<!--
* Copyright (C) 2013 Neo Visionaries Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@TakahikoKawasaki
TakahikoKawasaki / mvn-download.sh
Last active January 4, 2016 18:59
Script to download a maven artifact
#!/bin/sh
#
# Copyright (C) 2014 Neo Visionaries Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@TakahikoKawasaki
TakahikoKawasaki / index.js
Created October 31, 2015 23:10
Amazon AWS Lambda function protected by OAuth 2.0 access token using Authlete
var async = require('async');
var request = require('request');
// The API credentials of your service. These are needed to call Authlete
// Web APIs.
var api_key = '{Your-Service-API-Key}';
var api_secret = '{Your-Service-API-Secret}';
// A function to call Authlete's introspection API.
//
@TakahikoKawasaki
TakahikoKawasaki / index.js
Created March 1, 2016 20:40
"Amazon API Gateway Custom Authorizer" (node.js) の例
// "Amazon API Gateway Custom Authorizer" (node.js) の例
// Copyright (c) 2016 Authlete, Inc.
//
// The MIT License
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
@TakahikoKawasaki
TakahikoKawasaki / EchoClient.java
Last active August 14, 2020 09:39
A sample WebSocket client application using nv-websocket-client library.
/*
* Copyright (C) 2015 Neo Visionaries Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
@TakahikoKawasaki
TakahikoKawasaki / NaiveSSLContext.java
Created May 3, 2015 17:18
A factory class which creates an SSLContext that naively accepts all certificates without verification.
/*
* Copyright (C) 2015 Neo Visionaries Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
@TakahikoKawasaki
TakahikoKawasaki / sinatra+ssl.rb
Created December 16, 2014 14:44
Sinatra + SSL
#!/usr/bin/env ruby
#
# This code snippet shows how to enable SSL in Sinatra.
#
require 'sinatra/base'
class Application < Sinatra::Base
configure do
set :bind, '0.0.0.0'