all repos — dotfiles @ 6e4ae2cc5f9dd2be6e0770c4a51561fd654d569f

linux dotfiles

add update_gist script and passmenu
Prithu Goswami prithugoswami524@gmail.com
Fri, 10 Jul 2020 22:22:12 +0530
commit

6e4ae2cc5f9dd2be6e0770c4a51561fd654d569f

parent

ca32924e33e04b42e4623f4a3aad455cac2e8ab9

2 files changed, 50 insertions(+), 0 deletions(-)

jump to
A bin/misc/update_gist

@@ -0,0 +1,25 @@

+#!/bin/sh + +if [ "$1" ] +then +cat "$1" | sed ':a;N;$!ba;s/\n/\\n/g' | sed 's/"/\\"/g' > content + +cat <<EOF > payload +{ + "description": "REST API docs for LMM Counsellor App", + "files": { + "REST API Counsellor.md": { + "content": "`cat content`", + "filename": "REST API Counsellor.md" + } + } +} +EOF + +curl -s -X PATCH\ + -H 'Authorization: token f9586f6dde6425d3e41569e1e6bf721b1abe4c4e'\ + -d@payload\ + https://api.github.com/gists/c1b86bac8046770f8718d60e120f92ea > /dev/null 2>&1 + +rm payload content +fi
A bin/scripts/passmenu

@@ -0,0 +1,25 @@

+#!/usr/bin/env bash + +shopt -s nullglob globstar + +typeit=0 +if [[ $1 == "--type" ]]; then + typeit=1 + shift +fi + +prefix=${PASSWORD_STORE_DIR-~/.password-store} +password_files=( "$prefix"/**/*.gpg ) +password_files=( "${password_files[@]#"$prefix"/}" ) +password_files=( "${password_files[@]%.gpg}" ) + +password=$(printf '%s\n' "${password_files[@]}" | dmenu "$@") + +[[ -n $password ]] || exit + +if [[ $typeit -eq 0 ]]; then + pass show -c "$password" 2>/dev/null +else + pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | + xdotool type --clearmodifiers --file - +fi