Skip to content

Instantly share code, notes, and snippets.

View DeepInThought's full-sized avatar
🎯
Focusing

DeepInThought

🎯
Focusing
View GitHub Profile
class PipeServer
{
static
int
Main(string[] args)
{
if(args.Length < 2
||(System.String.Compare(args[0], "in") != 0
&& System.String.Compare(args[0], "out") != 0)) {
System.Console.WriteLine("Usage: PipeServer <in | out> <process> <args>");

Announcing cargo-udeps

One of the biggest issues that most people have with Rust are the long compile times. One of the reasons why compile times are so long is because many projects use quite a few dependencies from crates.io. Your dependencies have dependencies of their own, and they in turn have dependencies as well, and so on. This results in really big graphs of crates that all have to be compiled by cargo. Sometimes however, a crate actually doesn't use anything of some of its dependencies. Then those dependencies can be removed, resulting in faster builds for that crate. But how do you detect them? Often they sit in Cargo.toml for a long time until someone discovers they are actually unused and removes them (example). This is where cargo-udeps comes in. cargo-udeps is an automated tool to find dependencies that were specified in Cargo.toml but never used in the cra

provider "aws" {
region = "us-east-1"
shared_credentials_file = "~/.aws/credentials"
profile = "${var.aws_profile}"
}
terraform {
backend "s3" {
bucket = "your.bucket.com"
key = "path/to"
@skwp
skwp / bitcoin_contest.rb
Created January 29, 2019 02:37
Bitcoin Hash Based Contest
# Takes a list of people and a set of block hashes and picks people from the list based on their
# position when the block hash is taken modulo the number of participants.
# This assumes there won't be two of the same answer. If there are, the code can be modified to pick the next person in the list, or something like that
contest_participants = %w(
@MSPcrypto
@vinod5473
@Crypto_celt
@HoldingsMidwest
@belair6909
function bitcoinAddnode() {
nodeToAdd=$1
dnsLookup $nodeToAdd
bitcoinExec "addnode $ip:$BITCOIN_PORT add"
}
for peer in $newline_peerlist; do
bitcoinAddnode $peer
done
@skwp
skwp / ban-on-boot.sh
Created November 29, 2018 20:47
ban-on-boot.sh
function bitcoinExec() {
command=$1
log "Bitcoin Exec: $command"
bitcoinExecResult=$(docker exec bitcoin /usr/local/bin/bitcoin-cli
-rpcuser=$TAG_rpcuser \
-rpcpassword=$TAG_rpcpassword \
$command)
}
function bitcoinBan() {
thingToBan=$1
@skwp
skwp / Dockerfile
Created October 26, 2018 18:32
bitcoin Dockerfile
FROM ubuntu:14.04
RUN apt-get -y update && apt-get -y install vim curl htop libgoogle-perftools-dev && apt-get -y autoremove
COPY bin/bitcoin-cli /usr/local/bin
COPY bin/bitcoind /usr/local/bin
RUN apt-get install -y software-properties-common
RUN add-apt-repository -y ppa:bitcoin/bitcoin
RUN apt-get update --fix-missing && apt-get install -y --force-yes libdb4.8-dev libdb4.8++-dev libboost-all-dev libminiupnpc-dev libevent-dev
#!/usr/bin/env bash
# Runs a command against the btc node running in docker
# Usage: ./btcrpc [command]
command=$@
if [[ -z "$command" ]]; then
echo "Usage: ./btcrpc [command]"
echo "Example: ./btcrpc getmininginfo"
exit 1
fi
if [[ -z "$rpcpassword" ]]; then
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
network=$1
filename=$2
if [[ -z "$network" ]]; then
echo "Usage: ./restore-chainstate network [filename]"
echo "Restores chainstate. Example: ./restore-chainstate test1 2018-05-07/bitcoin.tgz"
echo "If filename is omitted, will restore to whatever was in /tmp/bitcoin.tgz, typically what we booted with"
fi
stop_command="btcstop"
#!/usr/bin/env bash
BUCKET=our.s3.bucket.com
FILE=$1
if [[ ! -z "$FILE" ]]; then
/usr/local/bin/aws s3 cp s3://$BUCKET/bitcoin-backups/$FILE /tmp/restore.tgz
else
echo "File not specified, will restore backup we started with (assumed to be in /tmp/bitcoin.tgz)"
cp /tmp/bitcoin.tgz /tmp/restore.tgz
fi
# Save the peers