Skip to content

Instantly share code, notes, and snippets.

#if defined(__APPLE__)
#if !defined(bswap_16)
// Mac OS X / Darwin features; we include a check for bswap_16 because if it is already defined, protobuf has
// defined these macros for us already; if it isn't, we do it ourselves. In either case, we get the exact same
// result regardless which path was taken
#include <libkern/OSByteOrder.h>
#define bswap_16(x) OSSwapInt16(x)
#define bswap_32(x) OSSwapInt32(x)
#!/usr/bin/env python3
# Code from https://github.com/bitcoinbook/bitcoinbook/blob/develop/code/max_money.py
# float128 and int64
import numpy as np # https://pypi.org/project/numpy/
# print to file
import sys # https://stackoverflow.com/questions/34926517/stop-sys-stdout-from-writing-to-a-text-file/34926590
# open - print to file
orig_stdout = sys.stdout
if (next_target > (previous_diff * 150) / 100) { next_target = (previous_diff * 150) / 100; }
if ((previous_diff * 150) / 100 > next_target) { next_target = (previous_diff * 150); }
@itwysgsl
itwysgsl / LWMA3.cpp
Last active October 25, 2018 18:10
// Copyright (c) 2017-2018 The Bitcoin Gold developers
// Copyright (c) 2018 Zawy & MicroBitcoin (LWMA-3)
// Algorithm by zawy, a modification of WT-144 by Tom Harding
// https://github.com/zawy12/difficulty-algorithms/issues/3#issuecomment-388386175
// Updated to LWMA3 by iamstenman
// MIT License
unsigned int Lwma3CalculateNextWorkRequired(const CBlockIndex* pindexLast, const Consensus::Params& params)
{
const int64_t T = params.nPowTargetSpacing;
@itwysgsl
itwysgsl / LWMA2.cpp
Last active September 21, 2018 18:30
// LWMA for BTC clones
// Copyright (c) 2017-2018 The Bitcoin Gold developers
// Copyright (c) 2018 Zawy (M.I.T license continued)
// Algorithm by zawy, a modification of WT-144 by Tom Harding
// Code by h4x3rotab of BTC Gold, modified/updated by zawy
// Updated to LWMA2 by iamstenman
// https://github.com/zawy12/difficulty-algorithms/issues/3#issuecomment-388386175
unsigned int Lwma2CalculateNextWorkRequired(const CBlockIndex* pindexLast, const Consensus::Params& params)
{
[Unit]
Description=Redis In-Memory Data Store
After=network.target
[Service]
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always
@itwysgsl
itwysgsl / install-redis.md
Created August 9, 2018 18:28 — forked from hackedunit/install-redis.md
Install and configure Redis on Ubuntu 16.04 with systemd
  1. Install pre-requisities

sudo apt-get install build-essential tcl

  1. Install Redis
cd /tmp
curl -O http://download.redis.io/redis-stable.tar.gz
tar xzvf redis-stable.tar.gz