Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
clientId=xxx
clientSecret=xxx
login_hint=1001
user_code=675325
backchannelReq=`cat << EOS
curl http://localhost:8080/api/backchannel/authentication -X POST \
import * as functions from 'firebase-functions'
import * as cookie from 'cookie'
// // Start writing Firebase Functions
// // https://firebase.google.com/docs/functions/typescript
//
export const addCookie = functions.https.onRequest((request, response) => {
response.setHeader('Cache-Control', 'private') // Hosting経由だと、これがないとset cookieが削除される
_addCookie(response, 'key', 'value')
response.send('Hello from Firebase!')
package nu.mine.kino.springboot;
/*
* Copyright 2012-2016 the original author or authors.
*
* 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
*
@masatomix
masatomix / file0.txt
Last active December 15, 2018 12:20
Qiitaで数式がつかえるみたいなので三角関数とか内積とか相関係数について書いて、Pythonで計算してみた ref: https://qiita.com/masatomix/items/278a233c39b4e82d0bad
\left(
\begin{array}{c}
\cos\theta\\
\sin\theta
\end{array}
\right)
@masatomix
masatomix / HmacSha256Main.java
Created August 18, 2017 00:44
HmacSHA256 によるハッシュのサンプル
package nu.mine.kino;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.Mac;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Base64;
@masatomix
masatomix / AccessTokenRequestParam.java
Last active August 8, 2017 07:38
JerseyでJSONオブジェクトをPOSTする件
@Data
@AllArgsConstructor
public class AccessTokenRequestParam {
private String redirect_url;
private String client_id;
private String client_secret;
@masatomix
masatomix / HS256Main.java
Last active May 13, 2021 09:12
HS256 / RSA256 を用いたサンプル。共通鍵、公開鍵でハッシュした署名をつけるJWSのサンプルと、公開鍵で署名したJWTを検証するサンプルコード。
package nu.mine.kino;
import java.text.ParseException;
import com.nimbusds.jose.JOSEException;
import com.nimbusds.jose.JWSAlgorithm;
import com.nimbusds.jose.JWSHeader;
import com.nimbusds.jose.JWSObject;
import com.nimbusds.jose.JWSVerifier;
import com.nimbusds.jose.KeyLengthException;