Skip to content

Instantly share code, notes, and snippets.

@refo
refo / docker exec by name.md
Created December 6, 2022 11:08
Docker exec by name: Search containers by name and exec on the first container
NAME=someapp_api; CMD=bash; docker exec -it `docker ps -f name="${NAME}" --format '{{.ID}}' | head -n 1` ${CMD}
@refo
refo / rename.ps1
Created April 27, 2022 11:22
power-shell rename all files
gci .\src\ -Recurse -Filter *.js | Rename-Item -NewName {$_.name -replace '.js', '.jsx'}
@refo
refo / 0 generate password.md
Created December 13, 2021 09:33
generate a secure password on debian
apt install -y pwgen
pwgen -B1ys 30 20 | grep -v [\'\"\`] | head -n 1
@refo
refo / 0 Postgresql on Debian
Last active December 13, 2021 11:34
Debian Postgres
Postgresql on Debian
@refo
refo / 0- Docker Caddy Wordpress.md
Last active September 27, 2022 14:28
Docker Caddy Wordpress

Docker Caddy Wordpress

@refo
refo / Warning: remote host identification has changed.md
Created October 14, 2021 15:45
Warning: remote host identification has changed

Remove the host from known_hosts

If you trust the server and already know that server fingerprint changed due to re-install for example; you could just remove the previous identification from the known_hosts file.

ssh-keygen -R "remote.host.ip"
@refo
refo / Disable Microsoft AutoUpdate on MacOS.md
Last active November 3, 2024 07:37
Disable Microsoft AutoUpdate on MacOS (Office 365 updater)

Following commands disables Microsoft AutoUpdate launch agent from launching at boot and periodicaly checking for updates.

sudo defaults write /Library/LaunchAgents/com.microsoft.update.agent.plist Disabled -bool YES
sudo defaults write /Library/LaunchAgents/com.microsoft.update.agent.plist RunAtLoad -bool NO
sudo chflags schg /Library/LaunchAgents/com.microsoft.update.agent.plist

source: https://forums.macrumors.com/threads/how-to-get-rid-of-microsoft-autoupdate.2231809/?post=28384662#post-28384662

@refo
refo / install-imagick.sh
Last active April 13, 2021 21:37 — forked from rjnienaber/install.sh
Compile ImageMagick with WEBP and HEIC support on Ubuntu 16.04
# $ lsb_release -a
# No LSB modules are available.
# Distributor ID: Ubuntu
# Description: Ubuntu 16.04.5 LTS
# Release: 16.04
# Codename: xenial
# $ uname -a
# Linux xps 4.4.0-134-generic #160-Ubuntu SMP Wed Aug 15 14:58:00 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
@refo
refo / iTerm2 navigate between words using option and horizontal arrow keys.md
Last active February 18, 2021 13:34
iTerm2 navigate between words using option and horizontal arrow keys

Determine bound keys for your terminal emulator

Determine the sequence for one-word backward navigation

bindkey -L | grep backward-word

example output

#!/usr/bin/env bash
DBNAME=$1
DIR=$2
DUMP=/usr/bin/mysqldump
PREFIX="${DBNAME}";
SUFFIX=$(date +"%F-%H%M%S");
FILENAME="${PREFIX}-${SUFFIX}.sql";