Skip to content

Instantly share code, notes, and snippets.

View vraravam's full-sized avatar

Vijay Aravamudhan vraravam

  • ThoughtWorks Inc.
  • Chennai, India
  • X @avijayr1
View GitHub Profile
@vraravam
vraravam / .zlogin
Last active April 18, 2024 09:13
~/.zlogin
#!/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
#!/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/vraravam/698925e88a601d18a79f9c79edc33611/raw -o fresh-install-vijay.sh; chmod +x ./fresh-install-vijay.sh; ./fresh-install-vijay.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"}
@vraravam
vraravam / capture-defaults.sh
Last active March 6, 2024 07:45
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.
@vraravam
vraravam / .zshenv
Last active April 18, 2024 09:12
file location: ~/.zshenv
#!/usr/bin/env zsh
# vim:syntax=zsh
# vim:filetype=zsh
# file location: ${HOME}/.zshenv
# invoked by all invocations of Zsh, so we should keep it small and merely initialise necessary variables.
# https://blog.patshead.com/2011/04/improve-your-oh-my-zsh-startup-time-maybe.html
@vraravam
vraravam / approve-fingerprint-sudo.sh
Last active April 18, 2024 09:11
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!!!"
@vraravam
vraravam / .zshrc.custom
Last active April 18, 2024 09:16
This is a companion script for the `~/.zshrc` file
#!/usr/bin/env zsh
# vim:syntax=zsh
# vim:filetype=zsh
# file location: ${HOME}/.zshrc.custom
# Note: This file depends on the ${HOME}/.zshrc that is also shared for some shell functions
load_file_if_exists "${HOME}/.aliases"
@vraravam
vraravam / .gitignore
Last active April 18, 2024 09:19
~/.gitignore
# file location: ${HOME}/.gitignore
!.bundle/config
!.keep
.~lock*#
.babel.json
.boxfuse/
.bundle/cache
.cisco/vpn/log
@vraravam
vraravam / .p10k.zsh
Last active April 18, 2024 09:17
File location: ~/.p10k.zsh
# Generated by Powerlevel10k configuration wizard on 2024-03-24 at 07:22 IST.
# Based on romkatv/powerlevel10k/config/p10k-rainbow.zsh, checksum 4117.
# Wizard options: nerdfont-v3 + powerline, small icons, rainbow, unicode, 12h time,
# angled separators, sharp heads, flat tails, 1 line, compact, many icons, concise,
# fluent, instant_prompt=quiet.
# 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.
#
@vraravam
vraravam / .gitconfig-template.inc
Last active April 18, 2024 09:20
~/.gitconfig-template.inc
# file location: ~/.gitconfig-template.inc
[user]
name = <your-name>
email = <your-email>
@vraravam
vraravam / .zprofile
Last active April 18, 2024 09:14
This is a companion script for the `~/.zshrc` file
#!/usr/bin/env zsh
# vim:syntax=zsh
# vim:filetype=zsh
# file location: ${HOME}/.zprofile
# Note: This file is loaded BEFORE ${HOME}/.zshrc
# login shell - only env vars and other functions that don't load anything should go in here
# This is a companion script for the `${HOME}/.zshrc` file