Skip to content

Instantly share code, notes, and snippets.

Justin C. boxofrox

Block or report user

Report or block boxofrox

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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:

@boxofrox
boxofrox / error.txt
Created Nov 14, 2017
build error in carnix 0.4.6 with rustc 1.21.0
View error.txt
$ nix-env -iA nixos.carnix
... build crates ...
Building src/main.rs (carnix)
Running rustc --crate-name carnix src/main.rs --crate-type bin -C opt-level=3 --out-dir target/bin --emit=dep-info,link -L dependency=target/deps -L native=/nix/store/gplwjf38jzylm1kfxgyd9z5a1lkvhlzv-rust_backtrace-sys-0.1.16/backtrace-sys.out/.libs -L native=/nix/store/z650nric4bzz9h0i1dj54dgx2gbzyyp4-sqlite-3.21.0/lib -l sqlite3 -l static=backtrace --extern clap=/nix/store/da54ljzhdj1w9lnjany9nhpmfaf13i9j-rust_clap-2.27.1/libclap-0d0f70b4fe.rlib --extern env_logger=/nix/store/4fjlf2fs9fjpj88b8yzcmv1yxanzrwgr-rust_env_logger-0.4.3/libenv_logger-44fd8c2574.rlib --extern error_chain=/nix/store/b2s6m89igvcp7igp95pv5pqzlwnrkrnk-rust_error-chain-0.11.0/liberror_chain-e3c9b7a037.rlib --extern log=/nix/store/zi0py5c94qzzdqsvd9nsffx3clr7pxq2-rust_log-0.3.8/liblog-4ed683d9af.rlib --extern nom=/nix/store/c2bymx136ba85j1k0k9pzimdfi5y8ymp-rust_nom-3.2.1/libnom-ab93402e0b.rlib --extern regex=/nix/store/wxnlnhqimhwa3dz2npp5v0bb8g0gwi41-r
@boxofrox
boxofrox / decode.out
Created Nov 6, 2017
Decoding /outputs/nvimpam_mid.stdout for KillTheMule
View decode.out
[ 94 - fixarray length 4
0 00 - fixint 0
0 00 - fixint 0
nvim_command ac - fixstr with 12 bytes
[ 91 - fixarray length 1
echom "rust client connected to neovim" d9 27 - str with 39 letters
]
]
[ 94 - fixarray length 4
View keybase.md

Keybase proof

I hereby claim:

  • I am boxofrox on github.
  • I am boxofrox (https://keybase.io/boxofrox) on keybase.
  • I have a public key ASCJO3UC2OMQ78uBO_FrS5rGfPHhEBzAfaoRoJYaVtRIJAo

To claim this, I am signing this object:

@boxofrox
boxofrox / openssl-self-signed-san-certificate.md
Created Jun 30, 2017 — forked from jdeathe/openssl-self-signed-san-certificate.md
How to generate a self-signed SAN SSL/TLS certificate using openssl
View openssl-self-signed-san-certificate.md

How to generate a self-signed SAN SSL/TLS certificate using openssl

Generating a self-signed certificate is a common taks and the command to generate one with openssl is well known and well documented. Generating a certificate that includes subjectAltName is not so straght forward however. The following example demonstrates how to generate a SAN certificate without making a permanent change to the openssl configuration.

Generate a list of all required DNS names, (Note: CN will be discarded).

$ export SAN="DNS:www.domain.localdomain,DNS:domain.localdomain"
You can’t perform that action at this time.