Skip to content

Commit

Permalink
notes
Browse files Browse the repository at this point in the history
  • Loading branch information
BostX committed Oct 18, 2023
1 parent 6ee74ea commit f890250
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 28 deletions.
5 changes: 4 additions & 1 deletion notes/git.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,11 @@
GIT_TRACE=1 git commit --amend --no-edit --gpg-sign | rg 'trace: run_command: \(gpg .*\)'
echo "dummy" | <put-here-the-gpg-run_command-shown-above>
#
# show how the pid of gpg-agent an the command line how was it started
ps h -o pid,command -p (pidof gpg-agent)
pkill gpg-agent
gpg-agent --pinentry-program=$(which pinentry) --daemon
gpg-agent --pinentry-program=(which pinentry-gtk-2) --daemon
# gpg-agent --pinentry-program=(which pinentry) --daemon

# delete all remote/origin branches except 'master'
git --git-dir=$dgx/.git branch --all | \
Expand Down
1 change: 0 additions & 1 deletion notes/guix.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,6 @@
}

@block{@block-name{TODO}
https://guix.gnu.org/manual/devel/en/html_node/Using-Guix-Interactively.html

Protesilaos Stavrou
https://protesilaos.com/emacs/dotemacs
Expand Down
36 changes: 12 additions & 24 deletions notes/guix_repl.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,31 @@

REPL-commands (start with ',')
https://www.gnu.org/software/guile/manual/guile.html#REPL-Commands
https://guix.gnu.org/manual/devel/en/html_node/Using-Guix-Interactively.html

;; pretty-print from shell / execute a scheme expression
$ guile -c '(use-modules (ice-9 pretty-print)) (pretty-print \'(begin ...))'
$ guix repl
,use (ice-9 pretty-print) ;; ,use is an alias for ,import or (import ...)
;; ,use (guix read-print) ; pretty-printer smarter than (ice-9 pretty-print).
;; (pretty-print-with-comments (current-output-port) '1)
,pretty-print '(begin ...)
;; access module variables w/o importing the whole module
,pretty-print '(begin ...)
,h inspect ;; REPL debugging:
,inspect EXP [,i] - Inspect the result(s) of evaluating EXP.
,pretty-print EXP [,pp] - Pretty-print the result(s) of evaluating EXP.
,pk ;; peek

;; repl: access module variables without importing the whole module
(@"@" (my module) public-variable)
(@"@"@"@" (my module) private-variable)

$ guix repl
,use (guix read-print) ;; pretty-printer smarter than (ice-9 pretty-print).
(pretty-print-with-comments (current-output-port) '1)

# disable colors and readline bindings defined in the .guile
@; INSIDE_EMACS=1 # bash
set INSIDE_EMACS 1 # fish-shell
guix repl --listen=tcp:37146 &
M-x geiser-connect
;; REPL debugging:
;; displays the call stack (aka backtrace) at the point where the debugger was
;; entered

;; guix repl: Print a backtrace
;; debugging: guix repl: Print a backtrace / callstack
> ,bt
;; Change the stackframe
> ,up [COUNT] ; ,frame [COUNT] ,down [COUNT]
Expand All @@ -44,8 +43,7 @@
scheme@"@"(srfi srfi-1)> ,help module
scheme@"@"(srfi srfi-1)> ,binding

;; guix repl
;; <list of procedures>
;; guix repl: <list of procedures>
scheme@"@"(srfi srfi-1)> ,pretty-print (module-uses (current-module))
$_ = (#<interface (guile) 7ffa54060dc0>
#<autoload (system base compile) 7ffa540edb40>
Expand All @@ -54,11 +52,7 @@
#<interface (ice-9 threads) 7ffa540a2aa0>
#<interface (value-history) 7ffa52cce5a0>
#<interface (geiser emacs) 7ffa51539f00>)
scheme@"@"(guile-user) > ,h inspect ; REPL debugging:
Inspect Commands [abbrev]:
;;
,inspect EXP [,i] - Inspect the result(s) of evaluating EXP.
,pretty-print EXP [,pp] - Pretty-print the result(s) of evaluating EXP.

scheme@"@"(guile-user)> ,use (gnu packages base)
scheme@"@"(guile-user)> coreutils
;; quit / terminate the repl with exit / return code 0
Expand Down Expand Up @@ -88,14 +82,8 @@
$ guix repl
scheme@"@"(guile-user)> (use-modules (gnu packages))
scheme@"@"(guile-user)> (specification->package+output "glib:bin")
$5 = #<package glib@"@"2.72.3 gnu/packages/glib.scm:560 7f9ff955f6e0>
$6 = "bin"
scheme@"@"(guile-user)> (specification->package+output "glib:out")
$7 = #<package glib@"@"2.72.3 gnu/packages/glib.scm:560 7f9ff955f6e0>
$8 = "out"
;; "out" is the default package output
scheme@"@"(guile-user)> (specification->package+output "glib")
$9 = #<package glib@"@"2.72.3 gnu/packages/glib.scm:560 7f9ff955f6e0>
$10 = "out"

$ guix repl
scheme@"@"(guix-user)> ,option value-history
Expand Down
2 changes: 2 additions & 0 deletions notes/linux.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@
}
@block{@block-name{Various}
# generate random 4 letter hexadecimal strings / numbers
printf "\"%s\"\n" (random | sha512sum | rg --only-matching .... | string join '" "')

os-prober - debian-installer component. Detects other operating system

Expand Down
4 changes: 2 additions & 2 deletions notes/shells.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
# fish-shell - all function arguments from 3rd to the last
$argv[3..-1]

# fish-shell existence-tests
# fish-shell exists / existence-tests
test (string escape -- $argv) = "--switch" # string equality / compare
test -e /path/to/file.txt # file exists
test -L /path/to/link # symbolic link exists
Expand All @@ -148,7 +148,7 @@
set -q myvar && echo "myvar is set to '$myvar'" || echo "myvar is unset"
test -z "$myvar" && echo "myvar is empty: '$myvar'" || echo "myvar is not empty: '$myvar'"

# bash-shell existence-tests
# bash-shell exists / existence-tests
# ${var+x} is a parameter expansion which evaluates to nothing if var is
# unset, and substitutes the string x otherwise.
# variable blank vs. unset - see https://stackoverflow.com/a/13864829
Expand Down
1 change: 1 addition & 0 deletions notes/thgtoa.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
# examples
gpg --output file.txt.gpg --encrypt --recipient foo@"@"domain.org file.txt
gpg --output file.txt --decrypt file.txt.gpg
gpg --quiet --for-your-eyes-only --no-tty --decrypt ~/.passwords/gmail.gpg

# -A NUM, --after-context=NUM
# man gpg | grep --after-context=2 show-usage
Expand Down

0 comments on commit f890250

Please sign in to comment.