- Pretty prompt
# Start colored text with: # %F{red} # End colored text with: # %F{red} # %n : user name # %m : computer name # %/ : current dir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# We don't need extra husky dependency for a simple task | |
COMMIT_LINT_HOOK_PATH="$PWD/.custom_git_hooks" | |
COMMIT_LINT_CMT_MSG_HOOK_PATH="$COMMIT_LINT_HOOK_PATH/commit-msg" | |
ensure_hook_dir() { | |
if [ ! -d "$COMMIT_LINT_HOOK_PATH" ]; then | |
mkdir "$COMMIT_LINT_HOOK_PATH" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
line_lengths=($(git log --pretty=format:%s | awk '{ print length($0) - 9 }')) | |
sum=0 | |
line_count=${#line_lengths} | |
for line_length in ${line_lengths[@]}; do | |
sum=$((sum + line_length)) | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const path = require('path'); | |
const target_dir = process.argv[2]; | |
fs.readdir(target_dir, function(err, items) { | |
for(var i = 0; i < items.length; i++) { | |
nfd_name = items[i]; | |
nfc_name = items[i].normalize('NFC'); | |
console.log(`nfd_name: ${nfd_name}\nnfc_name: ${nfc_name}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Data { | |
var hexDescription: String { | |
return reduce("") {$0 + String(format: "%02x", $1)} | |
} | |
} |
username@lima-docker:/Users/username$ echo '{ "insecure-registries": ["REGISTRY_HOST:REGISTRY_PORT"] }' > $HOME/.config/docker/daemon.json
username@lima-docker:/Users/username$ systemctl --user daemon-reload
username@lima-docker:/Users/username$ systemctl --user stop docker
username@lima-docker:/Users/username$ systemctl --user start docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# IMPORTANT: Don't forget to logout from your Apple ID in the settings before running it! | |
# IMPORTANT: You will need to run this script from Recovery. In fact, macOS Catalina brings read-only filesystem which prevent this script from working from the main OS. | |
# This script needs to be run from the volume you wish to use. | |
# E.g. run it like this: cd /Volumes/Macintosh\ HD && sh /Volumes/Macintosh\ HD/Users/sabri/Desktop/disable.sh | |
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars. | |
# Get active services: launchctl list | grep -v "\-\t0" | |
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openKeychain() | |
-- Count how many entries you have, or just pick one. | |
-- Having excessive number won't hurt. | |
repeat 300 times | |
tell application "System Events" to keystroke return | |
copyPastePlainTexts() | |
copyPastePassword() | |
openKeychain() |
NewerOlder