Skip to content

Instantly share code, notes, and snippets.

Justin C. boxofrox

View GitHub Profile
@boxofrox
boxofrox / .bashrc
Created Feb 10, 2020 — forked from kevinoid/.bashrc
GnuPG pinentry script for terminal or graphical interface based on $PINENTRY_USER_DATA.
View .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# If file exists (likely) copy fragment below into existing script:
# If stdin is a terminal
if [ -t 0 ]; then
# Set GPG_TTY so gpg-agent knows where to prompt. See gpg-agent(1)
export GPG_TTY="$(tty)"
# Set PINENTRY_USER_DATA so pinentry-auto knows to present a text UI.
export PINENTRY_USER_DATA=USE_TTY=1
@boxofrox
boxofrox / readme.md
Last active Dec 23, 2019
Debugging streaming audio over TCP
View readme.md
@boxofrox
boxofrox / Cargo.toml
Last active Dec 2, 2019
rustc E0277 when using async block vs without.
View Cargo.toml
[package]
name = "debug-await-method-chaining"
version = "0.1.0"
authors = ["boxofrox"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tokio = { version = "0.2", features = [ "full" ] }
@boxofrox
boxofrox / .gitignore
Last active Nov 12, 2019
Print file limits for systemd services.
View .gitignore
result
*.qcow2
@boxofrox
boxofrox / cargo_test.txt
Last active Mar 15, 2018
simple shell parser in Rust using combine crate (not working)
View cargo_test.txt
$ cargo test
Compiling csvmap v0.1.0 (file:///home/charetjc/files/development/rust/tinker/csvmap)
Finished dev [unoptimized + debuginfo] target(s) in 2.34 secs
Running target/debug/deps/csvmap-cdc7458d4bf17d5e
running 5 tests
test tests::can_parse ... ok
test tests::can_parse_single_quoted_shell_arg ... ok
test tests::can_parse_double_quoted_shell_arg ... ok
test tests::can_parse_any_shell_arg ... FAILED
@boxofrox
boxofrox / playground.rs
Created Mar 13, 2018 — forked from anonymous/playground.rs
Rust code shared from the playground
View playground.rs
#[macro_use] extern crate nom;
fn to_s(i: Vec<u8>) -> String {
String::from_utf8_lossy(&i).into_owned()
}
named!( single_quoted_shell_arg(&[u8]) -> String
, map!( delimited!( char!('\'')
, escaped_transform!( take_until!("\\'")
, "\\"
@boxofrox
boxofrox / install.txt
Last active Dec 4, 2017
Installing pijul 0.8.3 on NixOS
View install.txt
# Setup rust overlay to gain access to rust nightlies with fix for jobserver error
cd $HOME
git clone https://github.com/mozilla/nixpkgs-mozilla.git
cd nixpkgs-mozilla
./rust-overlay-install.sh
# Install rust nightly (swap nixos with nixpkgs if not on NixOS?)
nix-env -iA nixos.latest.rustChannels.nightly.rust
# Setup environment to link openssl
@boxofrox
boxofrox / a-rust-utils.nix
Created Dec 1, 2017
Example result for extracting shell code from rust-utils.nix
View a-rust-utils.nix
# Code for buildRustCrate, a Nix function that builds Rust code, just
# like Cargo, but using Nix instead.
#
# This can be useful for deploying packages with NixOps, and to share
# binary dependencies between projects.
{ lib, buildPlatform, stdenv, defaultCrateOverrides, fetchCrate, ncurses, rustc }:
let buildCrate = { crateName, crateVersion, crateAuthors, buildDependencies,
dependencies, completeDeps, completeBuildDeps,
@boxofrox
boxofrox / crates-overlay.nix
Last active Nov 20, 2017
carnix bug: example: missing cargo environment variables for compiling http-box crate
View crates-overlay.nix
# ~/.config/nixpkgs/overlays/crates-overlay.nix
self: super:
{
rustHttpBox = super.callPackage ./crates/httpbox.nix { };
}
@boxofrox
boxofrox / a-question.md
Created Nov 16, 2017
How to compute the SHA256 hash for a new Nix package?
View a-question.md

How does one find the sha256 of a new package?

I read that I should put a garbage sha256 into my package file, build it, and nix will report the correct sha256 I should use.

I put sha256 = "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b" into my package file as the garbage sha256.

When I built the package, the error reports:

You can’t perform that action at this time.