Skip to content

Instantly share code, notes, and snippets.

View truongnmt's full-sized avatar
🎯
Rails, Auth, Blockchain, Deep Learning

Truong Nguyen truongnmt

🎯
Rails, Auth, Blockchain, Deep Learning
View GitHub Profile
# @param {String} s
# @return {Integer}
def roman_to_int(s)
total = 0
roman_symbols = {"I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000}
s.length.times do |i|
unless s[i+1]
total += roman_symbols[s[i].to_sym]
next
<samlp:Response Destination="http://localhost:3000/saml/acs"
ID="R6a89d138da36c2ae5326fa1b182cfbdacae147ce"
InResponseTo="_5ccbb20771005b0328997e1cd5e468470b247427" IssueInstant="2020-01-22T07:05:25Z"
Version="2.0" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
<saml:Issuer>https://app.onelogin.com/saml/metadata/fed4e0ba-c59b-4098-adfa-17c20814bb57</saml:Issuer>
<samlp:Status><samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/></samlp:Status>
<saml:Assertion ID="pfxedfb003f-4a53-2b9b-6484-da8d76d97531" IssueInstant="2020-01-22T07:05:25Z"
Version="2.0" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
@truongnmt
truongnmt / saml-response.xml
Created January 21, 2020 10:38
saml response
<samlp:Response
ID="_a2aec7e7-1843-443c-9af3-da94e69d5113"
Version="2.0"
IssueInstant="2020-01-21T06:59:36.653Z"
Destination="https://localhost:4447/acs"
InResponseTo="_9ecd6234ec0396a49a33a8a2ae0a9f8d2acc1b2a" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
<Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">https://sts.windows.net/xxxx-xxxx-xxxx/
</Issuer>
<samlp:Status>
<samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
@truongnmt
truongnmt / application.js
Created June 10, 2019 02:36
Rails 6 add toastify-js library
// This file is automatically compiled by Webpack, along with any other files
// present in this directory. You're encouraged to place your actual application logic in
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.
require("@rails/ujs").start()
require("turbolinks").start()
require("@rails/activestorage").start()
require("channels")
require("toastify-js")
@truongnmt
truongnmt / tmux-cheatsheet.markdown
Created February 12, 2019 05:42 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@truongnmt
truongnmt / log1.txt
Created October 1, 2018 07:41
Log running 4 peers
This file has been truncated, but you can view the full file.
[2018-10-01 06:51:57.718814157][th:844][info] MAIN start
[2018-10-01 06:51:57.719331458][th:844][info] MAIN config initialized
[2018-10-01 06:51:57.721021123][th:844][info] IROHAD created
[2018-10-01 06:51:57.721137462][th:844][info] StorageImpl:initConnection Start storage creation
[2018-10-01 06:51:57.724719196][th:844][info] StorageImpl:initConnection block store created
[2018-10-01 06:51:57.749120917][th:844][info] IROHAD [Init] => storage
[2018-10-01 06:51:57.850837185][th:844][info] StorageImpl drop wsv records from db tables
[2018-10-01 06:51:58.019703906][th:844][info] StorageImpl drop blocks from disk
[2018-10-01 06:51:58.025269632][th:844][info] StorageImpl create mutable storage
[2018-10-01 06:51:58.025316898][th:844][info] FlatFile get(0) file not found
@truongnmt
truongnmt / log1.txt
Created October 1, 2018 06:38
Log running 4 peers
[2018-10-01 06:22:22.848930686][th:530][info] MAIN start
[2018-10-01 06:22:22.849425465][th:530][info] MAIN config initialized
[2018-10-01 06:22:22.850645921][th:530][info] IROHAD created
[2018-10-01 06:22:22.850675674][th:530][info] StorageImpl:initConnection Start storage creation
[2018-10-01 06:22:22.852077404][th:530][info] StorageImpl:initConnection block store created
NOTICE: relation "role" already exists, skipping
NOTICE: relation "domain" already exists, skipping
NOTICE: relation "signatory" already exists, skipping
NOTICE: relation "account" already exists, skipping
NOTICE: relation "account_has_signatory" already exists, skipping
@truongnmt
truongnmt / gist:fdc82bc28eff7b15ecdf4131f310c9d3
Last active September 22, 2018 09:33
genesis.block new admin
$ cat stable/genesis.block
{
"payload":{
"transactions":[
{
"payload":{
"reducedPayload":{
"commands":[
{
"addPeer":{
[2018-09-07 02:05:17.374967752][th:10][info] MAIN start
[2018-09-07 02:05:17.375792856][th:10][info] MAIN config initialized
[2018-09-07 02:05:17.376857761][th:10][info] IROHAD created
[2018-09-07 02:05:17.377521364][th:10][info] StorageImpl:initConnection Start storage creation
[2018-09-07 02:05:17.378290568][th:10][info] StorageImpl:initConnection block store created
NOTICE: relation "role" already exists, skipping
NOTICE: relation "domain" already exists, skipping
NOTICE: relation "signatory" already exists, skipping
NOTICE: relation "account" already exists, skipping
Welcome to Iroha-Cli.
Choose what to do:
1. New transaction (tx)
2. New query (qry)
3. New transaction status request (st)
> : 1
Forming a new transactions, choose command to add:
1. Detach role from account (detach)
2. Add new role to account (apnd_role)
3. Create new role (crt_role)