Skip to content

Instantly share code, notes, and snippets.

View rbuckland's full-sized avatar

Ramon Buckland rbuckland

  • Inosion
  • Sydney Australia
View GitHub Profile
@rbuckland
rbuckland / locate_folders_with_missing_files.md
Last active March 19, 2023 00:25
find folders that are missing files

A strange migration tip;

situation.

Have an existing sizeable python repo with embedded /test/folders - hundreds of tests (makes sense, tests are local to the code) - large++ code base

  • some test folders have modules, (helpers, utils) but are missing init.py files

  • goal: locate all directories under test folders, that don't have init.py files, but do have *.py files,

@rbuckland
rbuckland / shellspec_and_bazel.md
Created November 16, 2022 10:40
shellspec and bazel

shellspec and bazel

  • goal have bazel run some shell spec testing using shellspec
  • caveat won't run on windows (sh_test(..) is not supported there)
  • caveat this is not rules_shellspec - though this is close.
  • observation shellspec was fussy, but it ran in the end.
@rbuckland
rbuckland / help.mk
Last active June 16, 2021 02:49
helper make file
#
# This is the Help Support
# Include like
# Makefile:-----------------
# ....
# include help.mk
# ---------------------------
#
# Original is from: https://codereview.stackexchange.com/questions/94307/built-in-help-in-a-makefile
#
@rbuckland
rbuckland / es-cqrs-comparison-for-rust.md
Last active September 10, 2022 02:40
rust es / cqrs comparison chart
@rbuckland
rbuckland / dc@.service
Last active April 15, 2021 22:41
template systemd service unit - /lib/systemd/system/dc@.service
[Unit]
Description=%i service powered by docker compose
Requires=docker.service
After=docker.service
[Service]
Restart=always
TimeoutStartSec=300
# Create a directory for each docker-composed service at /srv/docker/.
@rbuckland
rbuckland / samples.rs
Created September 15, 2018 06:59
My Rust Snippets
// https://stackoverflow.com/questions/25576748/how-to-compare-enum-without-pattern-matching
macro_rules! matches(
($e:expr, $p:pat) => (
match $e {
$p => true,
_ => false
}
)
);
21:05 $ cargo build
Compiling markdown_tools v0.4.0 (file:///home/rbuckland/projects/internal/github.com/inosion/markdown-tools)
error[E0597]: `vfilts` does not live long enough====================> ] 70/72: markdown_tools
--> src/lib.rs:126:82
|
126 | Some(vfilts) => Box::new(data.iter().filter(|row| filter_tablerows(row, &vfilts))),
| ----- capture occurs here ^^^^^^ borrowed value does not live long enough
127 | };
| - borrowed value only lives until here
...
@rbuckland
rbuckland / pull_out_vec_option_from_struct_member.rs
Created July 31, 2018 22:24
Get an Option<Vec<_>> from Option<struct: Option<Vec>>
extern crate serde_json;
#[derive(Debug)]
struct Foo {
bar: Option<Vec<&'static str>>
}
fn show(f: Option<Foo>) {
let v = f.and_then(|f1| f1.bar);
println!("vec == {:?}", v);
}
@rbuckland
rbuckland / rpi-motion.md
Last active July 5, 2018 17:20
raspberry pi3 webcam setup

rasbian

  • added 'ssh' to boot partition for4 enabling ssh
  • apt update
  • apt upgrade
  • raspi-config - setup wifi
  • rpi-update - to add the webcam drivers
  • sudo chown -R motion:motion /var/lib/motion
@rbuckland
rbuckland / cube_and_cylinder.scad
Last active October 2, 2016 00:06
cube to cylinder merge
module move(x=0,y=0,z=0,rx=0,ry=0,rz=0) { translate([x,y,z])rotate([rx,ry,rz]) children(); }
module cube_and_cylinder(dia=10, height=20) {
// i often move everything to center .. and "transform/move" it from there
// cubes and other shapes are "default" at 0,0,0, but cylinders are at 0,0 for center
// so moving the cube to center aligns it with the cube
move(rz=45) cube([dia,dia,dia],center=true);