Skip to content

Instantly share code, notes, and snippets.

View randria's full-sized avatar
💭
I may be slow to respond.

richard randria

💭
I may be slow to respond.
View GitHub Profile
@randria
randria / README.md
Last active November 15, 2024 09:26

docker managed by lima on OSX

no need to install the docker-desktop package

  • We assume you have installed lima with brew
    brew install lima
  • Download docker template
    mkdir -p ${HOME}/.lima/docker
@randria
randria / gist:72521dc48cbd79f262bf1ebe8f3d7a9b
Last active April 28, 2024 16:41
Using jq application
@randria
randria / tips.md
Created April 19, 2024 11:54
vim tips

TIPS for edition

wrap text to 80 columns

:%!fold -w 60
:set textwidth=80
@randria
randria / backup-codimd.sh
Created July 18, 2023 14:01
Backup CodiMD Content
#!/bin/bash
set -e
# OSX is not a Linux! But bash works on both ;-)
if [ $(uname -s) != "Darwin" ]; then
echo "** I know you should run this on a Mac :) But it's a bash, so you can adapt it on your risk! **"
exit 1
fi
# check if it's a git repo
@randria
randria / hashme.sh
Created July 18, 2023 05:36
hash photo files and move to another file removing duplicates
#!/bin/bash
do_hash(){
[ -f shasum.txt ] && mv -fv shasum.txt shasum_$(date +%s).txt
shasum -a 256 * | tee -a shasum.txt && \
awk '{print $1}' shasum.txt | sort | uniq > shasum_hash.txt
}
do_move(){
[ -z "$1" -o $# -eq 0 ] && return 1
SRC=$(pwd); DST=$1;
comm -23 ${SRC}/shasum_hash.txt ${DST}/shasum_hash.txt | while read hash; do FILE=$(grep ^$hash ${SRC}/shasum.txt | awk '{print $2}'|head -1); [ ! -f ${SRC}/$FILE ] && continue; mv -v ${SRC}/$FILE ${DST}/new-$(echo $hash | head -c12).${FILE#*.} && sed -I_bak "/^$hash/d" ${SRC}/shasum.txt; done
@randria
randria / generate-passwd.sh
Created March 15, 2023 15:16
bcrypt-cli output on docker
docker run -it --rm golang:1.17 bash -c "go install github.com/bitnami/bcrypt-cli@v1.0.2 &> /dev/null && echo -n secret | bcrypt-cli"
@randria
randria / Brewfile
Created July 8, 2022 20:21
My Brewfile
tap "esolitos/ipa"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "homebrew/core"
tap "homebrew/services"
tap "numworks/tap"
brew "gdbm"
brew "libffi"
brew "readline"
@randria
randria / list.md
Last active November 13, 2023 12:32
Your Mac Environment

Update softwares

  • list available updates
    softwareupdate -l
    
  • to install updatables
    softwareupdate -i -a
    
@randria
randria / rsync_exclude_osx.txt
Last active November 3, 2021 08:48
MacOSX rsync exclude files
.*swp
.~*
$RECYCLE.BIN
$Recycle.Bin
.AppleDB
.AppleDesktop
.AppleDouble
.com.apple.timemachine.supported
.dbfseventsd
.DS_Store