Skip to content

Instantly share code, notes, and snippets.

@cs2dsb
cs2dsb / system.rs
Created July 30, 2017 20:10
Configuring stm32f7 for 216MHz using svd2rust api
///This configures the clock for full 216mHz performace. Copied from SystemClock_Config() in ST hal examples
fn configure_clock(&self, rcc: &RCC, pwr: &PWR, flash: &FLASH) {
/* Enable HSE Oscillator and activate PLL with HSE as source */
//Enable the HSE
rcc.cr.modify(|_, w| w.hseon().enabled());
//Wait till HSE is ready (should add a timeout comparing to HSE_STARTUP_TIMEOUT
//hprintln!("Waiting for HSE to be ready");
wait_until_true(&|| rcc.cr.read().hserdy().bit_is_set());
//hprintln!("HSE is ready");
@cs2dsb
cs2dsb / README.md
Last active May 18, 2017 22:05
Grab bearer token from refresh-token stored by Amazon Cloud Drive desktop app

Extract oauth token from Amazon Drive app

A quick mono app hacked together to extract the refresh-token from the Amazon Drive desktop app and use it to get a valid bearer token.

Will probably break when the app updates as it has a hardcoded initialization vector in the source file. My guess is you don't need to ever run the app again after the initial login but the code is fairly complex and I've only spent an hour investigating this.

No idea what Amazon would think about this use of the app but since it's an oauth token issued to me for uploading to my cloud drive it's probably not that much of an issue. Happy to remove the gist if there are any concerns.

@cs2dsb
cs2dsb / gorptest.go
Last active August 29, 2015 14:23
Reproduce Gorp issue #265
package main
import (
"database/sql"
"log"
"github.com/go-gorp/gorp"
_ "github.com/mattn/go-sqlite3"
)