Skip to content

Instantly share code, notes, and snippets.

View Jayashakthi28's full-sized avatar
🎯
Focusing

Jayashakthi Vishnu Jayashakthi28

🎯
Focusing
View GitHub Profile
@Jayashakthi28
Jayashakthi28 / osx-defaults.sh
Created March 6, 2024 02:58
OSX Defaults to setup a brand new machine
#!/usr/bin/env bash
# TODO: Need to figure out the settings for the following:
# 1) Dock: Items with order (not capturing binary data - since that is dependent on installed apps)
# 2) Security & Privacy Preferences: Full Disk Access, Camera, Microphone
# 3) Login items for my user (i.e. apps started when I login)
# 4) Retina displays scaling
# 5) Finder sidebar with order
##
@Jayashakthi28
Jayashakthi28 / approve-fingerprint-sudo.sh
Created March 6, 2024 02:58
This script is used to setup the command-line sudo requests to fire up the fingerprint authentication on MBPs which have this feature. This file can be put anywhere in the path.
#!/usr/bin/env bash
# To be able to use the mac touchbar for sudo command auth:
# edit the following file: /etc/pam.d/sudo
# and add the following line after the initial comment line:
# `auth sufficient pam_tid.so`
# This script also verifies that this line is added only once (ie skips if already present)
COUNT=`grep pam_tid /etc/pam.d/sudo | wc -l`
if [[ $COUNT -gt 0 ]]; then
echo "ALREADY PRESENT - Not adding again!!!"
@Jayashakthi28
Jayashakthi28 / capture-defaults.sh
Created March 6, 2024 02:57
Export or import settings from any macos application (whether system app or custom installed app). Caveat: Stores data in binary format specific to macos
#!/usr/bin/env bash
# file location: Put this anywhere in the path.
# This script will capture (export) the settings or import the settings from the location specified in the $TARGET_DIR env var defined down below. You can back the files up to any cloud storage and retrieve into the new laptop to then get back all settings as per the original machine. The only word of caution is to use it with the same OS version (I haven't tried in any situations where the old and new machines had different OS versions - so I cannot guarantee if that might break the system in any way)
# A trick to find the name of the app:
# Run `defaults read` in an empty window of a terminal app, then use the search functionality to search for a known word related to that app (like eg app visible name, author, some setting that's unique to that app, etc). Once you find this, trace back to the parent in the printed JSON to then get the real unique name of the app where its settings are stored.
#!/usr/bin/env zsh
# Note: This script is specific to my setup and not useful for others.
# You can run this script using this command:
# curl -L https://gist.githubusercontent.com/Jayashakthi28/e182043672a8f396543f6f6d204f3b31/raw --create-dirs -o ${HOME}/.bin/macos/fresh-install-jsv.sh; chmod +x ${HOME}/.bin/macos/fresh-install-jsv.sh; ${HOME}/.bin/macos/fresh-install-jsv.sh
# These env vars are duplicated intentionally since this script would bootstrap the installation
USERNAME=${USERNAME:-$(whoami)}
PERSONAL_PROFILES_DIR=${PERSONAL_PROFILES_DIR:-"${HOME}/personal/${USERNAME}/profiles"}
PERSONAL_BIN_DIR=${PERSONAL_BIN_DIR:-"${HOME}/.bin"}
@Jayashakthi28
Jayashakthi28 / .gitignore
Last active March 6, 2024 06:09
~/.gitignore
# file location: ${HOME}/.gitignore
!.bundle/config
!.keep
__pycache__
.~lock*#
.asdf/
.aws/config
.babel.json
# file location: ~/.gitconfig
# Note:
# [Windows users] If you are on windows, please search for the word 'windows' - and fix those lines - they seem to cause some trouble
# [General] Since some of the settings are specific to my setup (ie presence of fles), I have marked those lines with comments 'Personal' - you can go ahead and change those to your equivalents or delete them altogether
# [General] Since I use 'diff-so-fancy' as the diffing tool, it's absence on your system will cause some errors. If you are able to, I would sincerely urge you to install and use it for a much better experience. If not, please replace all such occurrences back to use 'diff'
# Note: Even though this will show up twice in `git config -l` - it will still be overridden based on the order of the includeIf lines below
[includeIf "gitdir/i:~/"] # Personal
path = ~/.gitconfig-oss.inc # Personal
#!/usr/bin/env zsh
# vim:syntax=zsh
# vim:filetype=zsh
# file location: ${HOME}/.aliases
# Add flags to existing aliases.
alias less="${aliases[less]:-less} -RF"
alias ls="${aliases[ls]:-ls} -G"
# Generated by Powerlevel10k configuration wizard on 2024-01-17 at 14:38 IST.
# Based on romkatv/powerlevel10k/config/p10k-rainbow.zsh, checksum 40544.
# Wizard options: nerdfont-complete + powerline, small icons, rainbow, unicode,
# 12h time, angled separators, sharp heads, blurred tails, 2 lines, disconnected,
# full frame, darkest-ornaments, sparse, many icons, concise, transient_prompt,
# instant_prompt=verbose.
# Type `p10k configure` to generate another config.
#
# Config for Powerlevel10k with powerline prompt style with colorful background.
# Type `p10k configure` to generate your own config based on it.
@Jayashakthi28
Jayashakthi28 / .zlogin
Last active March 5, 2024 04:36
zlogin file
#!/usr/bin/env zsh
# vim:syntax=zsh
# vim:filetype=zsh
# file location: ${HOME}/.zlogin
# Note: This file is loaded AFTER ${HOME}/.zshrc
function recompile-zsh-scripts-as-reqd {
if [[ -s "${1}" && (! -s "${1}.zwc" || "${1}" -nt "${1}.zwc") ]]; then
@Jayashakthi28
Jayashakthi28 / fresh-install-of-osx.sh
Last active March 6, 2024 07:04 — forked from vraravam/fresh-install-of-osx.sh
Steps to get "up and running" with new Mac OSX
#!/usr/bin/env bash
# This script can be used to setup a macos machine based on Vijay's configurations. As of now, this script is idempotent and will restore your local setup to the same state if run multiple times.
# If you have the same files already present, it will prompt you whether to override or not
# file location: <anywhere> (just need to invoke it from that location)
# You can run this script using this command:
# curl -L https://gist.githubusercontent.com/Jayashakthi28/9fe39ae1fae9f51f9471251feec0c6b1/raw --create-dirs -o ${HOME}/.bin/macos/fresh-install.sh; chmod +x ${HOME}/.bin/macos/fresh-install.sh; ${HOME}/.bin/macos/fresh-install.sh
USERNAME=${USERNAME:-$(whoami)}