Skip to content

Instantly share code, notes, and snippets.

View jamesmunns's full-sized avatar

James Munns jamesmunns

View GitHub Profile
pub fn handler(&self, req: CoAPRequest) -> Option<CoAPResponse> {
match req.get_option(CoAPOption::UriPath) {
Some(req_path) => {
match req.get_class() {
MessageClass::RequestType(rq_type) => {
match self.map.get(&rq_type) {
Some(dispatch) => {
dispatch.get(&req_path)
},
None => None,
# COMPARE TWO REFERENCES (Branch, Tag, Commit), both in Read-Only Mode
# Use (from the git repo root):
# <path to script>/diffref.sh master 123abcd
# Build destination folder
DATEHASH=`echo "obase=16; $(date +%s)" | bc`
DESTFOLDER1=/tmp/diffref-$DATEHASH-$1
DESTFOLDER2=/tmp/diffref-$DATEHASH-$2
mkdir $DESTFOLDER1
mkdir $DESTFOLDER2
# COMPARE A REFERENCE AGAINST WORKING DIRECTORY
# Use (from the git repo root):
# <path to script>/diffref.sh master
# Build destination temp folder
DATEHASH=`echo "obase=16; $(date +%s)" | bc`
DESTFOLDER=/tmp/diffref-$DATEHASH-$1
mkdir $DESTFOLDER
# Export Reference
import bcrypt as bc
import simplecrypt as sc
# Assume a SQL database, with two tables:
# "User" - contains username, password hash, website settings
# "Data" - contains data related to all users. Not sensitive (CC#'s, SSN#'s, Addresses),
# but some kind of metric data users may not want publicly associated with them
# such as bookmarks, favorite foods, shoe size, etc.
#
# Instead of encrypting ALL user data, which would be slow and defeat the purpose of