Need to setup gpg-agent first, on OSX I use keychain (it also does ssh-agent)
$ brew info keychain
keychain: stable 2.8.5
User-friendly front-end to ssh-agent(1)
https://www.funtoo.org/Keychain
/usr/local/Cellar/keychain/2.8.5 (7 files, 108.5KB) *
-- +--------+-------+-------+ | |
-- | init | mod | exp | | |
-- |--------+-------+-------| | |
-- | 6 | -1 | 5 | | |
-- | 5 | 0 | 4 | | |
-- | 4 | 1 | 6 | | |
-- | 3 | 0 | 3 | | |
-- | 2 | -1 | 1 | | |
-- | 1 | 0 | 2 | | |
-- +--------+-------+-------+ |
/* | |
* MIT License | |
* | |
* Copyright (c) 2023-2024 Fabio Lima | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is |
# frozen_string_literal: true | |
# Before (creates prepared statement for each varying size of given array): | |
# | |
# $ Post.where(id: [uuid1, uuid2]) | |
# => Post Load (0.6ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" IN ($1, $2) [["id", "a830f21d-a27b-4bde-8c05-6e5dd088712e"], ["id","531ee026-d60d-4a59-a9a5-d44c44578a98}"]] | |
# | |
# After (the only one statement for varying size of given array): | |
# | |
# $ Post.where(id: [uuid1, uuid2]) |
## TL;DR | |
setopt extendedglob | |
ls *(<tab> # to get help regarding globbing | |
rm ../debianpackage(.) # remove files only | |
ls -d *(/) # list directories only | |
ls /etc/*(@) # list symlinks only | |
ls -l *.(png|jpg|gif) # list pictures only | |
ls *(*) # list executables only | |
ls /etc/**/zsh # which directories contain 'zsh'? |
This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.
Description | Syntax |
---|---|
Get the length of a string | ${#VARNAME} |
Get a single character | ${VARNAME[index]} |
# The refinement module helps to inspect a composed source of meta-generated methods, | |
# which were defined via Module#module_eval or Module#class_eval methods | |
# in strings with interpolations. | |
# | |
# Unless this refinement is using, looking up for an actual source of such | |
# kind of method will result with a raw string literal with no interpolation applied. | |
# | |
# It's monkey patch the Module#module_eval and Module#class_eval methods to | |
# write a source with applied interpolation into a temporary file per method owner and | |
# substitutes an evaluted located path & lineno for the string. |