Skip to content

Instantly share code, notes, and snippets.

@ArunJRK
ArunJRK / count_lines.sh
Last active March 26, 2024 17:47
# A zsh script to count number of lines in files in a folder. Useful for finding number of lines in a project. Generated using GPT4 and Claude Sonnet
#!/opt/homebrew/bin/zsh
# List of folders to exclude
excluded_folders=(
"node_modules"
"dist"
"coverage"
"assets"
".git"
)
#!/bin/zsh
# Install Brew
zsh -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)";
# add Brew to path
echo "export $PATH=$PATH:/opt/homebrew/bin" >> .zshrc
# source
source ~/.zshrc

Notes for new laptop setup

  1. Install Brew
  2. Install zsh latest
  3. Set Zsh to be default terminal
  4. Install oh my zsh
  5. Install Visual Studio Code, asdf
  6. Install nodejs, python, go, rust asdf plugins
  7. Install latest version of nodes, pytho, go and rust using asdf
  8. Install jumpcut, rectangle
#!/bin/bash
iatest=$(expr index "$-" i)
#######################################################
# SOURCED ALIAS'S AND SCRIPTS BY zachbrowne.me
#######################################################
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
@ArunJRK
ArunJRK / IndianStates.json
Created August 13, 2020 07:27 — forked from shubhamjain/IndianStates.json
Indian States and Union Territories in JSON format
{
"AN":"Andaman and Nicobar Islands",
"AP":"Andhra Pradesh",
"AR":"Arunachal Pradesh",
"AS":"Assam",
"BR":"Bihar",
"CG":"Chandigarh",
"CH":"Chhattisgarh",
"DN":"Dadra and Nagar Haveli",
@ArunJRK
ArunJRK / image-minficaiton.js
Created August 4, 2020 07:56
This chokidar function watches folders for new added images and compresses them put in another folder. The function also finds out what is the image extension and gives output in that and also in .wep
const chokidar = require('chokidar');
const util = require('util');
var sharp = require('sharp');
const fs = require('fs');
const paths = require('path');
const copy = util.promisify(fs.copyFile);
const chokidar = require('chokidar');
const util = require('util');
var sharp = require('sharp');
const fs = require('fs');
const paths = require('path');
const copy = util.promisify(fs.copyFile);
const del = util.promisify(fs.unlink);
const watcher = chokidar.watch('./uploads', {
@ArunJRK
ArunJRK / node-and-npm-in-30-seconds.sh
Created July 6, 2020 10:44 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@ArunJRK
ArunJRK / mysql_dump.sh
Last active October 14, 2017 04:15 — forked from infynyxx/mysql_dump.sh
automated mysql dump using Linux Cron tab
#!/bin/sh
mysqldump -u username -p password –all-databases –routines| gzip > /root/MySQLDB_`date ‘+\%m-\%d-\%Y’`.sql.gz
mysqldump -h your-ip -u username -p password –all-databases –routines | gzip > /root/MySQLDB.3_`date ‘+\%m-\%d-\%Y’`.sql.gz
#now create cron script smth like this
#crontab -e
#30 15 * * * /root/MySQLdump.sh 2>&1>> /root/MySQLdump.log
#The above will dump the database every day at 15:30.