Skip to content

Instantly share code, notes, and snippets.

View RandyMcMillan's full-sized avatar
🛰️
Those who know - do not speak of it.

@RandyMcMillan RandyMcMillan

🛰️
Those who know - do not speak of it.
View GitHub Profile
@RandyMcMillan
RandyMcMillan / index.cjs
Created November 11, 2024 15:16
invoke nodejs from bash
#! /usr/bin/env bash
':' //; exec "$(command -v nodejs || command -v node)" "$0" "$@"
const path = require('node:path');
//console.log(__dirname);
//console.log(path.dirname(__filename));
const { access, constants } = require('node:fs')
const { exec } = require('child_process');
exec('which node', (error, stdout, stderr) => {
@RandyMcMillan
RandyMcMillan / main.rs
Created November 10, 2024 22:49
rust_async_task-1990/869775/426717
//Cargo.toml
//[package]
//name = "async-task"
//version = "0.1.0"
//edition = "2021"
//
//[dependencies]
//env_logger = "0.8.2"
//log = "0.4.13"
//tokio = { version = "1", features = ["full"] }
@RandyMcMillan
RandyMcMillan / main.rs
Created November 10, 2024 22:48
rust_async_task-1990/869774/428654
//Cargo.toml
//[package]
//name = "async-task"
//version = "0.1.0"
//edition = "2021"
//
//[dependencies]
//env_logger = "0.8.2"
//log = "0.4.13"
//tokio = { version = "1", features = ["full"] }
@RandyMcMillan
RandyMcMillan / main.rs
Created November 10, 2024 22:45
rust_async_task-1990/869774/428486
use log::{info, trace};
use std::collections::VecDeque;
use std::sync::{mpsc, Arc, Mutex};
use std::time::Duration;
use tokio;
/// Create a WorkQueue of any type that holds all the work to be done
#[derive(Clone)]
@RandyMcMillan
RandyMcMillan / main.rs
Created November 10, 2024 22:45
rust_async_task-1990/869774-428454
use log::{info, trace};
use std::collections::VecDeque;
use std::sync::{mpsc, Arc, Mutex};
use std::time::Duration;
use tokio;
/// Create a WorkQueue of any type that holds all the work to be done
#[derive(Clone)]
@RandyMcMillan
RandyMcMillan / main.rs
Created November 10, 2024 22:41
rust_async_task
use log::{info, trace};
use std::collections::VecDeque;
use std::sync::{mpsc, Arc, Mutex};
use std::time::Duration;
use tokio;
/// Create a WorkQueue of any type that holds all the work to be done
#[derive(Clone)]
var hypercore = require('hypercore')
var ram = require('random-access-memory')
var feed = hypercore(ram)
feed.append('hello world')
@RandyMcMillan
RandyMcMillan / cargo.mk
Created August 6, 2024 01:24
make-cargo-commands
##
##===============================================================================
##make cargo-*
cargo-help:### cargo-help
@awk 'BEGIN {FS = ":.*?###"} /^[a-zA-Z_-]+:.*?###/ {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
cargo-release-all:### cargo-release-all
## cargo-release-all recursively cargo build --release
for t in */Cargo.toml; do echo $$t; cargo b -r -vv --manifest-path $$t; done
for t in ffi/*/Cargo.toml; do echo $$t; cargo b -r -vv --manifest-path $$t; done
cargo-clean-all:### cargo-clean-all - clean release artifacts
@RandyMcMillan
RandyMcMillan / bitcoin.conf
Created August 2, 2024 17:20
plebnet-playground-bitcoin.conf
uacomment=plebnet.fun
signet=1
signetchallenge=512102ee856c56a5aaadd1656f849bafa4c9dacc86a2878fe546c6189185f842ae2c1851ae
[signet]
seednode=104.131.10.218:38333
addnode=104.131.10.218:38333
addnode=78.99.116.68:12346
ifeq ($(project),)
PROJECT_NAME := $(notdir $(PWD))
else
PROJECT_NAME := $(project)
endif
export PROJECT_NAME
VERSION :=$(shell cat version)
export VERSION
TIME :=$(shell date +%s)