Skip to content

Instantly share code, notes, and snippets.

@theuni
theuni / multiwallet.cpp
Created September 15, 2017 15:51
wallet_load_unload
#include "strong_ptr.h"
#include <cassert>
#include <chrono>
#include <cstdio>
#include <mutex>
#include <thread>
#include <vector>
namespace {
```diff
diff --git a/src/net.cpp b/src/net.cpp
index 0392f6b..15cf7ce 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -64,6 +64,7 @@
const static std::string NET_MESSAGE_COMMAND_OTHER = "*other*";
static const uint64_t RANDOMIZER_ID_NETGROUP = 0x6c0edd8036ef4036ULL; // SHA256("netgroup")[0:8]
+static const uint64_t RANDOMIZER_ID_LOCALHOSTNONCE = 0xd93e69e2bbfa5735ULL; // SHA256("localhostnonce")[0:8]
diff --git a/src/net.cpp b/src/net.cpp
index 0392f6b..15cf7ce 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -64,6 +64,7 @@
const static std::string NET_MESSAGE_COMMAND_OTHER = "*other*";
static const uint64_t RANDOMIZER_ID_NETGROUP = 0x6c0edd8036ef4036ULL; // SHA256("netgroup")[0:8]
+static const uint64_t RANDOMIZER_ID_LOCALHOSTNONCE = 0xd93e69e2bbfa5735ULL; // SHA256("localhostnonce")[0:8]
//
@theuni
theuni / gist:f5d6d3db9434ca546422
Created June 23, 2015 20:36
clang locking test
#include <vector>
#include <mutex>
#if defined(__clang__) && (!defined(SWIG))
#define THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x))
#else
#define THREAD_ANNOTATION_ATTRIBUTE__(x) // no-op
#endif
#define EXCLUSIVE_LOCKS_REQUIRED(...) THREAD_ANNOTATION_ATTRIBUTE__(exclusive_locks_required(__VA_ARGS__))
diff --git a/crypto/asn1/tasn_dec.c b/crypto/asn1/tasn_dec.c
index 6f19829..d28dc60 100644
--- a/crypto/asn1/tasn_dec.c
+++ b/crypto/asn1/tasn_dec.c
@@ -130,11 +130,17 @@ ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval,
{
ASN1_TLC c;
ASN1_VALUE *ptmpval = NULL;
- if (!pval)
- pval = &ptmpval;
cory@cory-i7:~/dev/openssl(OpenSSL_1_0_1m-backport)$ git diff -w manual-backport..gentoo-patched
diff --git a/crypto/asn1/tasn_dec.c b/crypto/asn1/tasn_dec.c
index 6f19829..d28dc60 100644
--- a/crypto/asn1/tasn_dec.c
+++ b/crypto/asn1/tasn_dec.c
@@ -130,11 +130,17 @@ ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval,
{
ASN1_TLC c;
ASN1_VALUE *ptmpval = NULL;
@theuni
theuni / dersig.cpp
Created January 14, 2015 09:25
dersig constexpr evaluation
// Compile with: g++ -std=c++11 dersig.cpp -o dersig
#include <cstddef>
#include <vector>
#include <array>
inline constexpr char getHex(const char in)
{
return in >= '0' && in <= '9' ? in - '0' :
in >= 'A' && in <= 'F' ? in - 'A' + 10 :
From b4cad5173902e69d125c99e639a6204773b2f52f Mon Sep 17 00:00:00 2001
From: Cory Fields <theuni-nospam-@xbmc.org>
Date: Wed, 13 Mar 2013 12:55:52 -0400
Subject: [PATCH] power: Add a bare-metal linux power implementation that
relies on being launched by init
---
xbmc/powermanagement/PowerManager.cpp | 17 +++++++---
xbmc/powermanagement/linux/FallbackPowerSyscall.h | 41 +++++++++++++++++++++++
2 files changed, 53 insertions(+), 5 deletions(-)
From 211c674f9f99b4057b6a8e230ec3a47b986ccdda Mon Sep 17 00:00:00 2001
From: Cory Fields <theuni-nospam-@xbmc.org>
Date: Mon, 11 Mar 2013 14:48:26 -0400
Subject: [PATCH] jni: OnLoad() is guaranteed to be called before
android_main(), so store the vm/env there.
---
xbmc/android/activity/JNIManager.cpp | 2 ++
xbmc/android/activity/android_main.cpp | 2 --
2 files changed, 2 insertions(+), 2 deletions(-)
From 0305caa07c0f9532a667d151076e7031d5fa5c40 Mon Sep 17 00:00:00 2001
From: Cory Fields <theuni-nospam-@xbmc.org>
Date: Sat, 3 Nov 2012 14:58:35 -0400
Subject: [PATCH] egl: Android: Add quirk for destroying nativewindow with
surface
Don't count on the driver to realize that the NativeWindow is stale, it may try
to use it and crash. Instead, forcefully kill it when we destroy a window in
order to force recreation later.
---