Skip to content

Instantly share code, notes, and snippets.

@mikemadden42
mikemadden42 / ubuntu-docker-setup.txt
Created April 9, 2022 13:00
Running ubuntu under docker
docker pull ubuntu:20.04
docker run -it --rm ubuntu:20.04 bash
set -o vi
cd $HOME
apt update && apt dist-upgrade -y && apt autoclean -y && apt autoremove -y
apt install git sudo vim-nox -y
mkdir src && cd src
git clone https://github.com/mikemadden42/ripley.git
@mikemadden42
mikemadden42 / clippy.txt
Created April 9, 2022 12:59
cargo clippy examples
cargo clippy -- -Wclippy::pedantic -Wrustdoc::private_intra_doc_links -Aclippy::single-match-else -Aclippy::default-trait-access -Aclippy::missing-panics-doc
cargo clippy -- -D warnings -A deprecated
@mikemadden42
mikemadden42 / cmake.txt
Created April 9, 2022 12:57
cmake examples
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
ctest -C Release
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release -j
ctest -C Release
cmake -B build -DCMAKE_BUILD_TYPE=Release
time cmake --build build --config Release --parallel
@mikemadden42
mikemadden42 / check_fs.cc
Created January 29, 2022 21:01
Check filesystem
#include <boost/filesystem.hpp>
#include <iostream>
// g++ -o boo boo.cc -lboost_filesystem
// clang++ -o boo boo.cc -lboost_filesystem
int main() {
boost::filesystem::path p("/");
auto freeSpace = boost::filesystem::space(p).free;
std::cout << freeSpace << " Bytes free" << std::endl;
@mikemadden42
mikemadden42 / pkg_hist.sh
Last active July 26, 2022 02:33
Package history for Debian/Ubuntu
#!/bin/bash
########
mkdir /tmp/dpkg_hist
rsync -av /var/log/dpkg.log* /tmp/dpkg_hist
pushd /tmp/dpkg_hist
gunzip *.gz
for f in $(ls -rt); do
cat $f | egrep 'install|remove' >>$HOME/hist.log
@mikemadden42
mikemadden42 / macinfo.zsh
Created January 29, 2022 20:57
macOS system info
#!/bin/zsh
echo "system_profiler SPHardwareDataType:"
system_profiler SPHardwareDataType
echo
echo "hostinfo:"
hostinfo
echo
@mikemadden42
mikemadden42 / update-rust.bat
Created November 24, 2021 12:31
Update rust toolchain
rustup self update
rustup update
rustup component add clippy
rustup component add rls rust-analysis rust-src
rustup component add rustfmt
@mikemadden42
mikemadden42 / check_brews.sh
Created October 17, 2021 19:23
Check brew formula
#!/bin/sh
# brew update -v
pushd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
for OS in arm64_monterey monterey arm64_big_sur big_sur catalina mojave high_sierra sierra el_capitan yosemite mavericks; do
echo ${OS}
#grep "sha256 .* :${OS}$" Formula/*.rb | wc -l
egrep "sha256.*${OS}:.*" Formula/*.rb | wc -l
@mikemadden42
mikemadden42 / update_go.zsh
Last active January 12, 2022 03:05
Build Go tools
#!/bin/zsh
# With go 1.17 use go install to install binaries:
# https://golang.org/doc/go-get-install-deprecation
# TODO: change many of these 'go get' to 'go install'.
# START UTILS
projects=(
github.com/BurntSushi/toml/cmd/tomlv
github.com/ChimeraCoder/gojson/gojson
@mikemadden42
mikemadden42 / update_macos.sh
Created January 6, 2021 01:04
Update macOS
#!/bin/sh -x
softwareupdate -l