通览了 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.
This started as a summary of this nice tutorial, but has since then become its own thing.
#!/usr/bin/python | |
import random | |
import numpy as np | |
from matplotlib import pyplot as plt | |
""" | |
Straight-forward implementation of PO2C. | |
""" | |
def po2c(num_buckets, num_groups, group_size): |
import tensorflow as tf | |
import random | |
import numpy as np | |
import time | |
BASIC_HOME = "/Users/allwefantasy/Downloads" | |
WORD_VECTOR_FILE = BASIC_HOME + '/laiwen/zhuhl_laiwen_word_embedding' | |
WORD_FILE = BASIC_HOME + '/laiwen/zhuhl_laiwen_keywords2' | |
WORD_RESULT_VECTOR_FILE = BASIC_HOME + '/laiwen/WORD_RESULT_VECTOR_FILE4' | |
MODEL_SAVE_DIR = BASIC_HOME + '/laiwen/model/autoencoder' |
#Source code with the blog post at http://monik.in/a-noobs-guide-to-implementing-rnn-lstm-using-tensorflow/ | |
import numpy as np | |
import random | |
from random import shuffle | |
import tensorflow as tf | |
# from tensorflow.models.rnn import rnn_cell | |
# from tensorflow.models.rnn import rnn | |
NUM_EXAMPLES = 10000 |
# docker-neuraltalk2 demo with webcam support (Warning: docker-neuraltalk2 image size > 3GB) | |
# Launch interactive container: | |
docker run -i -t -p 8000:8000 --privileged -v /dev/video0:/dev/video0 beevaenriqueotero/docker-neuraltalk2 /bin/bash | |
# And then execute: | |
git clone https://github.com/Mithul/neuraltalk2.git neuraltalk2-camera | |
luarocks install camera | |
cd neuraltalk2-camera/vis | |
python -m SimpleHTTPServer & | |
cd .. |
// the main app file | |
import express from "express"; | |
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db) | |
import authenticate from "./authentication"; // middleware for doing authentication | |
import permit from "./authorization"; // middleware for checking if user's role is permitted to make request | |
const app = express(), | |
api = express.Router(); | |
// first middleware will setup db connection |
What you need:
Download raspbian and install to SD-card. Here is a good guide on how to install the .img file to the card: https://www.andrewmunsell.com/blog/getting-started-raspberry-pi-install-raspbian
Connect ethernet or wifi, then boot the Raspberry Pi and follow configuration options. Make sure you enable the camera option.
When you get to the command-line:
#!/bin/sh | |
# this script was initially written for Redhat/CentOS | |
# file is /etc/cron.daily/diskAlert.cron | |
# requires enabling outgoing sendmail from localhost to a valid | |
# smtp server, which is usually disabled by default | |
ADMIN="jausten@adomain.com,another@adomain.com" | |
THRESHOLD=90 | |
df -PkH | grep -vE '^Filesystem|tmpfs|cdrom|media' | awk '{ print $5 " " $6 }' | while read output; | |
do |