Skip to content

Instantly share code, notes, and snippets.

App::new("rsurl")
.version(crate_version!())
.author(crate_authors!())
.setting(AppSettings::AllowMissingPositional)
.about("Http requests from the command line.")
.arg(
Arg::with_name("body")
.short("b")
.value_name("FILE")
.required(false),
@MartinWallgren
MartinWallgren / .bashrc
Created July 5, 2019 07:26
Bash function to navigate to a git project directory with fzf
function cdgit() {
local dir
dir=$(find $HOME -type d -name .git -exec dirname {} \; | fzf-tmux) && cd "$dir"
}
fn execute_hook(path: &Path, args: &Vec<String>, stdin: &Vec<u8>) {
let name = path.file_name().expect("Failed to get file name of hook.");
println!("Execute {:?}", &name);
let mut p = Command::new(path)
.stdin(Stdio::piped())
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.args(args)
.spawn()
@MartinWallgren
MartinWallgren / git-fixup
Last active July 7, 2025 13:17
Select a fixup commit using fzf
#!/bin/sh
# SPDX-FileCopyrightText: 2019 Martin Wallgren
#
# SPDX-License-Identifier: MIT
function usage() {
echo "Git command to help you select which commit to create a fixup commit for."
echo ""
echo "The command will let you select a commit from a range and commit the current"
echo "staging area using the selected commit as argument to the --fixup= option. Any"
echo "extra options passed to this command will be forwarded to the git commit"
export GRADLE_DEFAULT_OPTS='--offline'
function upfind() {
dir=`pwd`
while [ "$dir" != "/" ]; do