Skip to content

Instantly share code, notes, and snippets.

@refo
refo / Disable Microsoft AutoUpdate on MacOS.md
Last active March 7, 2024 13:06
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 / bash-filepath-parts.md
Last active February 2, 2024 11:57
Extract file name / file path parts using bash

Extract given file path into its parts

Assuming, file passed as a parameter

path=$1

following script will extract file path into parts

@refo
refo / remove-leading-slash
Created June 5, 2015 13:27
javascript - Remove leading slashes
'/example/string/'.replace(/^\/+/g, '');
// Should remove all leading slashes and return 'example/string/'
@refo
refo / macOS proxy settings from terminal.md
Last active January 23, 2023 17:05
macOS proxy settings from terminal

macOS firewall settings

Set socks proxy

networksetup -setsocksfirewallproxy Wi-Fi 127.0.0.1 7070

Get current socks proxy settings and state

networksetup -getsocksfirewallproxy Wi-Fi
@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 / 0- Docker Caddy Wordpress.md
Last active September 27, 2022 14:28
Docker Caddy Wordpress

Docker Caddy Wordpress

@refo
refo / parse-telefon.js
Last active September 27, 2022 10:32
Türkiye telefon numarası parse et.
var input = " + 9 0 asdas (532) 123 - 45 6 7 ";
var telefon = input.replace(/(^\D*9?\D*0|\D+)/ig, '');
console.log(telefon);
// Şunu yazdırır:
// 5321234567
//
// Çıktı 10 karakter ise, numara doğru kabul edilebilir.
@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 Postgresql on Debian
Last active December 13, 2021 11:34
Debian Postgres
Postgresql on Debian
@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