Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jamesmunns's full-sized avatar

James Munns jamesmunns

View GitHub Profile
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
# 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
# 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
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,
fn main() {
println!("Hello, world!");
}
// The idea is to take a stream of bytes that looks like this:
//
// < One Byte Length > < Field A Data >
// < One Byte Length > < Field B Data >
// < One Byte Length > < Field C Data >
// < Two byte CRC16CCITT >
//
// Max length of fields:
// A: 31 bytes, B: 40 bytes, C: 64 bytes
// Total (incl. metadata): 140 bytes

Keybase proof

I hereby claim:

  • I am jamesmunns on github.
  • I am jamesmunns (https://keybase.io/jamesmunns) on keybase.
  • I have a public key ASCJqj7QGR1krgSR7nVngi128xNPiIN0PLJHZtxP7USlLgo

To claim this, I am signing this object:

@jamesmunns
jamesmunns / bad.map
Created March 26, 2017 00:31
blue pill map files
target/thumbv7m-none-eabi/debug/bin: file format elf32-littlearm
SYMBOL TABLE:
08000000 l d .text 00000000 .text
08000ca8 l d .debug_gdb_scripts 00000000 .debug_gdb_scripts
00000000 l d .debug_str 00000000 .debug_str
00000000 l d .debug_abbrev 00000000 .debug_abbrev
00000000 l d .debug_info 00000000 .debug_info
00000000 l d .debug_ranges 00000000 .debug_ranges
@jamesmunns
jamesmunns / paring_output
Created April 13, 2017 11:04
Connect, then try to read from a service
[bt] [INF] show_dev_info: Identity: cf:75:ce:86:6d:02 (random)
[bt] [INF] show_dev_info: HCI: version 5.0 (0x09) revision 0x0000, manufacturer 0xffff
[bt] [INF] show_dev_info: LMP: version 5.0 (0x09) subver 0xffff
[bt] [WRN] bt_pub_key_gen: ECC HCI commands not available[0m
Bluetooth initialized
Advertising successfully started
Connected
Passkey for 77:a1:46:5a:a2:7a (random): 13868
Disconnected (reason 19)
.---------------------------.
| CI Server | .------------------------------.
|---------------------------| | Embedded Target |
| | |------------------------------|
| .-----------------------. | JTAG | .--------------------------. |
| | Cross Compiler | |<-------->| | Normal Device Firmware | |
| | Firmware Programmer | | | '--------------------------' |
| | Testing Framework | | UART | |
| | Test Hardware Drivers | |<-------->| |
| | Coprocessor Firmware | | | |