Skip to content

Instantly share code, notes, and snippets.

View nickray's full-sized avatar
🐝
putting pieces together

Nicolas Stalder nickray

🐝
putting pieces together
View GitHub Profile
/// Pretty dirty hack.
///
/// For security reasons, `signature::DigestSigner` doesn't want you to sign raw bytes.
/// However, we have a trusted client, and want it to be able to send the raw bytes for efficiency,
/// also because the blockchain messages internally calculate and independently use the hash.
///
/// So... we need to have a structure that
/// a) acts like a real Sha256 if initiated with Default and then updated + finalized
/// b) returns our desired pre-existing hash as final output if initiated from that
#[derive(Clone, Debug)]
@nickray
nickray / README.md
Last active May 24, 2022 08:48
Solo 2 firmware 1:20220317.0 pre-release

This firmware may break NFC, but should fix several outstanding issues with the existing 1.0.9 firmware bundle for Solo 2.

It uses the new "calver" representation of firmware versions, where 1:20220317.0 corresponds to the "semver" represeentation 1.806.0, with the middle item being the minor version component (806) interpreted as days since 2020-01-01, and major/patch version components corresponding directly.

Main changes:

  • shortened FIDO credential IDs (below 256 bytes), should work on all sites
  • improved memory management (previous firmwares often would crash due to stack overflow)
  • fixed/updated visual LED language for locked devices (red breathing for waiting, green blinking for processing, blue breathing for waiting on user touch, blue blinking for winking)

Gotcha:

@nickray
nickray / bump-jlink-date.py
Created February 1, 2021 20:53
Bump JLink "don't show again" date
@nickray
nickray / aarch64.patch
Created January 13, 2021 23:06
Patch to build jlink-software-and-documentation for ARM64
--- jlink-software-and-documentation/PKGBUILD 2021-01-09 10:48:38.000000000 +0000
+++ jlink-software-and-documentation.patched/PKGBUILD 2021-01-13 23:05:09.480407369 +0000
@@ -6,13 +6,14 @@
pkgrel=1
epoch=33
pkgdesc="Segger JLink software & documentation pack for Linux"
-arch=('i686' 'x86_64' 'armv7h')
+arch=('i686' 'x86_64' 'armv7h' 'aarch64')
license=('custom')
groups=('jlink')
BEGIN MESSAGE.
QvFKnz6ELQcWZDO ujb1BhREiV0L8n9 C9lfn6HA1goWTed rYz7BoyXKwLfDBp
VfCX5wughmlx0vv z6mSkzioHVlTCKq 6Xr2MZHgg6vfCZJ azdkg4sZbGqt9Aw
x2KrsVdJwQBnga6 txrLh77YyNxDMun oE4cU10Fk5l2wrT tw7Kb8FCRErvfSj
Cik3sGMLQcWeOJ4 q4onxKJ99fCCfzC yqlog2IP.
END MESSAGE.
fn setup<F>(f: F)
where F: Fn(
// &mut Service::<'_, '_, tests::MockRng, tests::InternalStorage<'_>, tests::ExternalStorage<'_>, tests::VolatileStorage<'_>>,
&mut Client<'_, &mut service::Service<'_, '_, tests::MockRng, tests::InternalStorage<'_>, tests::ExternalStorage<'_>, tests::VolatileStorage<'_>>>
) {
// whole lotta setup goin' on ;)
let mut request_queue = heapless::spsc::Queue(heapless::i::Queue::u8());
let mut reply_queue = heapless::spsc::Queue(heapless::i::Queue::u8());
fn serialize() {
// status: 0 = success;
self.buffer[0] = 0;
// actual payload
let writer = serde_cbor::ser::SliceWrite::new(&mut self.buffer[1..]);
let mut ser = serde_cbor::Serializer::new(writer)
.packed_format()
.pack_starting_with(1)
.pack_to_depth(1)
;
@nickray
nickray / faux-ral.rs
Last active September 21, 2019 23:46
macro_rules! reg_write {
($peripheral:ident, $register:ident, $field:ident, $value:expr) => {
unsafe { &(*hal::raw::$peripheral::ptr()).$register.write(|w| w.$field().bits($value)) }
};
}
macro_rules! reg_modify {
($peripheral:ident, $register:ident, $field:ident, $what:ident) => {
unsafe { &(*hal::raw::$peripheral::ptr()) }.$register.modify(|_, w| w.$field().$what())
};
}
@nickray
nickray / journalctl-logs.txt
Created July 29, 2019 22:10
journalctl logs during circleci local
Jul 30 00:07:09 berta systemd[1133]: var-lib-docker-overlay2-5a87e3fb3c215900e7ea7d01c2cda0d7a9d4c33545b52b3bd14c70a1a737624a\x2dinit-merged.mount: Succeeded.
Jul 30 00:07:09 berta systemd-udevd[3414]: link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.
Jul 30 00:07:09 berta systemd-udevd[3414]: Using default interface naming scheme 'v240'.
Jul 30 00:07:09 berta systemd-udevd[3414]: Could not generate persistent MAC address for veth2e9c1fe: No such file or directory
Jul 30 00:07:09 berta NetworkManager[636]: <info> [1564438029.4136] manager: (veth2e9c1fe): new Veth device (/org/freedesktop/NetworkManager/Devices/17)
@nickray
nickray / circleci-local.txt
Last active July 29, 2019 22:02
circleci local
% circleci local execute --job build --verbose
Docker image digest: sha256:480880a9a20859b277ee2365e4bdef6c68c0d23c022461d046c630697f771871
INFO[2019-07-29T22:00:51Z] Using config: .circleci/config.yml
DEBU[2019-07-29T22:00:51Z] local unix path configured path=/tmp/picard203297266/eventprocessor.sock
DEBU[2019-07-29T22:00:51Z] config received config_string="{\"TaskId\":\"localbuild-1564437651\",\"TaskInfo\":{\"BuildNum\":\"\",\"BuildURI\":\"\",\"NodeIndex\":0,\"NodeTotal\":1,\"ProjectAnalyticsID\":\"\",\"RepositoryURI\":\"git@github.com:nickray/zissou.git\",\"Branch\":\"master\",\"Revision\":\"53c7a624e406e44e5e763cba75285a9fb24d22fd\",\"CheckoutKey\":\"\",\"Job\":\"build\",\"SkipCheckout\":true,\"SkipCache\":false,\"SkipCacheSave\":false,\"SshKeys\":null,\"VcsKnownHostsEntry\":\"\",\"ResourceClassID\":\"\",\"Volumes\":null,\"Environment\":{},\"CircleEnvs\":{},\"Workflow\":{\"WorkflowID\":\"\",\"JobID\":\"\",\"WorkspaceID\":\"\",\"UpstreamJobIDs\":n