通览了 casbin 的文档,结合先前对 AWS IAM 的理解,以及对 ladon SDK 的使用,总结对比一下 Ladon & Casbin 两个授权库。
先对比两个项目的简介:
ladon
A SDK for access control policies: authorization for the microservice and IoT age. Inspired by AWS IAM policies. Written for Go.
# ------------------------------------------------------------------------------ | |
# Here's a simple but slightly confusing task in R: collapsing a 3d array into a | |
# matrix. Specifically, we want to convert a 3d array of this form: | |
# ------------------------------------------------------------------------------ | |
# , , 1 | |
# | |
# [,1] [,2] [,3] | |
# [1,] "1.1.1" "1.2.1" "1.3.1" | |
# [2,] "2.1.1" "2.2.1" "2.3.1" | |
# |
public class ReservationManager { | |
List<Reservation> reservations; | |
List<Table> tables; | |
Set<Customer> customers; | |
private static ReservationManager instance; | |
private ReservationManager(){ | |
customers = new HashSet<>(); | |
init(); |
###回文分割分析
####原题 对一个字符串按照回文进行分割,例如aba|b|bbabb|a|b|aba就是字符串ababbbabbababa的一个回文分割,每一个字串都是一个回文。请找到可以分割的最少的字串数。例如:
####分析 这个题目很多做过leetcode的同学都见过,所以很多同学直接回复了DP。不过还是建议大家动手写一写。熟能生巧的。那么该如何分析这个题目呢?
library(Quandl) | |
p <- 100 * Quandl('FRED/GDPDEF', collapse = 'quarterly', start_date = '1960-01-01', end_date = '2012-01-01', type = 'ts', transformation = 'rdiff') | |
#Michigan Inflation Expectations aren't in Quandl yet | |
library(quantmod) | |
getSymbols("MICH",src="FRED") | |
#Median expected price change next 12 months, Survey of Consumers. | |
#Convert to ts object | |
MICH.start <- as.numeric(format.Date(start(MICH), '%Y')) |
// Takes a credit card string value and returns true on valid number | |
function valid_credit_card(value) { | |
// Accept only digits, dashes or spaces | |
if (/[^0-9-\s]+/.test(value)) return false; | |
// The Luhn Algorithm. It's so pretty. | |
let nCheck = 0, bEven = false; | |
value = value.replace(/\D/g, ""); | |
for (var n = value.length - 1; n >= 0; n--) { |
/* Read this comment first: https://gist.github.com/tonious/1377667#gistcomment-2277101 | |
* 2017-12-05 | |
* | |
* -- T. | |
*/ | |
#define _XOPEN_SOURCE 500 /* Enable certain library functions (strdup) on linux. See feature_test_macros(7) */ | |
#include <stdlib.h> | |
#include <stdio.h> |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import urllib2 | |
gh_url = 'https://api.github.com' | |
req = urllib2.Request(gh_url) | |
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm() |