Skip to content

Instantly share code, notes, and snippets.

View joeartsea's full-sized avatar

Atsushi Kojo joeartsea

View GitHub Profile
@joeartsea
joeartsea / app.js
Last active April 10, 2018 07:01
Using express for Gsuite SAML SSO
'use strict'
const express = require('express')
const session = require('express-session')
const cookieParser = require('cookie-parser')
const bodyParser = require('body-parser')
const passport = require('passport')
const SamlStrategy = require('passport-saml').Strategy
const app = express()
passport.serializeUser(function (user, done) {
@joeartsea
joeartsea / node-red_playbook.yml
Last active December 26, 2017 06:37
node-red playbook
- hosts: all
sudo: yes
tasks:
- name: setup nodejs8.x
shell: curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
args:
creates: /usr/bin/node
- name: installing latest version of node.js
@joeartsea
joeartsea / 0_reuse_code.js
Created November 7, 2016 02:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@joeartsea
joeartsea / file0.txt
Created December 22, 2015 08:12
Force.com Canvasのsigned-requestを検証&デコードするNode-REDノード ref: http://qiita.com/joeartsea/items/e9c3a65fbc68c0212100
$ node-red-admin target <Node-REDのエディタ画面のURL 例:https://node-red-123.herokuapp.com/red>
$ node-red-admin login
Username: <Herokuにデプロイする時に設定したユーザ名>
Password: <Herokuにデプロイする時に設定したパスワード>
Logged in
$ node-red-admin install node-red-contrib-force
Module: node-red-contrib-force
Version: 0.0.6
Nodes Types State
@joeartsea
joeartsea / app.js
Created December 9, 2015 07:59
Node-REDの画面カスタマイズ方法 ref: http://qiita.com/joeartsea/items/6400e21eefa5a9b44e15
var http = require('http');
var express = require("express");
var settings = require("./settings"); // <- require
var RED = require("node-red");
// Create an Express app
var app = express();
// Add a simple route for static content served from 'public'
app.use("/",express.static("public"));
<script type="text/javascript">
RED.nodes.registerType('Nodeのタイプ', {
// Nodeの定義
});
</script>
@joeartsea
joeartsea / file2.txt
Last active December 6, 2015 14:35
Node-REDのNode作成はじめの1歩 ref: http://qiita.com/joeartsea/items/11cef78442c3e7154a07
{ init: [Function],
start: [Function: start],
stop: [Function: stop],
nodes:
{ init: [Function: init],
load: [Function: load],
createNode: [Function: createNode],
getNode: [Function],
eachNode: [Function],
addFile: [Function: addFile],
Welcome to Node-RED
===================
3 Dec 01:54:33 - [info] Node-RED version: v0.12.1
3 Dec 01:54:33 - [info] Node.js version: v0.12.7
3 Dec 01:54:33 - [info] Loading palette nodes
3 Dec 01:54:34 - [info] Settings file : [これが設定ファイルの場所]
3 Dec 01:54:34 - [info] User directory : [これがユーザディレクトリ]
3 Dec 01:54:34 - [info] Flows file : [これがflow設定ファイルの場所]
3 Dec 01:54:34 - [info] Server now running at http://127.0.0.1:1880/
@joeartsea
joeartsea / sample-NCMB-create-signature-node.js
Created September 9, 2015 04:35
sample NCMB create signature-node
var crypto = require("crypto");
var url = "https://mb.api.cloud.nifty.com/2013-09-01/login"
+ "?userName=" + process.env.USER_NAME
+ "&password=" + process.env.USER_PASS;
var method = 'GET';
var signature = "";
var _applicationKey = process.env.NCMB_APP_KEY;
var _timestamp = new Date().toISOString();
@joeartsea
joeartsea / heroku.js
Last active August 29, 2015 14:11
Using Heroku Platform API
var appName,
Heroku = require('heroku-client'),
heroku = new Heroku({ token: process.env.HEROKU_API_TOKEN });
heroku.apps().create().then(function (app) {
appName = app.name;
return heroku.apps(appName).addons().create({
"plan": "mongolab"
});
}).then(function (addon) {