Skip to content

Instantly share code, notes, and snippets.

@gaurangrshah
Last active September 2, 2021 01:15
Show Gist options
  • Save gaurangrshah/9a86a94c8fdcb43ad866dddecf4fe0fa to your computer and use it in GitHub Desktop.
Save gaurangrshah/9a86a94c8fdcb43ad866dddecf4fe0fa to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
all_args=("$@")
first_arg=$1
rest_args=("${all_args[@]:2}")
mkdir $1 && cd $1
npm init -y
curl -o ".gitignore" https://gist.githubusercontent.com/gaurangrshah/76cc7b8d4e79642b9f103267ef74a21f/raw
code .
git init
touch .env.sample && echo "NODE_ENV=" >> .env.sample
mkdir src && cd src
touch app.js && echo "// noop" >> app.js
mkdir hooks && touch ./hooks/.gitkeep
mkdir context && touch ./context/.gitkeep
mkdir utils && touch ./utils/.gitkeep
mkdir api && touch ./api/.gitkeep
mkdir server && touch ./server/.gitkeep
mkdir models && touch ./models/.gitkeep
cd ..
git add -A
git commit -m "init base repo"
if [ -z "$rest_args[@]" ]
then
echo "no packages to install"
else
for var in "${all_args[@]:1}"
do
echo "======= npm i -s "$var" ========="
npm i -s "$var"
echo "======= npm i -s "$var" ========="
done
git add -A
git commit -m "installed initial deps"
fi
echo "========== COMPLETE "$1" ============"
# https://support.apple.com/guide/terminal/make-a-file-executable-apdd100908f-06b3-4e63-8a87-32e71241bab4/mac
#
#!/usr/bin/env bash
touch "$1" && code "$1"
#!/bin/bash
#####################################################
# Download Specific folders from Github using SVN
#
# Author: Declan Cook
# Licence: MIT
#####################################################
GHDOMAIN="https://github.com/"
IN=$1
IN=${IN##$GHDOMAIN}
BRANCH="trunk"
FOLDER=""
IFS="/" read -a SECT <<< "$IN"
if [[ "${SECT[3]}" != "master" ]]; then
BRANCH=${SECT[3]}
fi
for index in "${!SECT[@]}"; do
if [ $index -gt 3 ]; then
FOLDER=$FOLDER/${SECT[index]}
fi
done
# DOMAIN/USER/PROJECT/<TRUNK||BRANCH>/FOLDER
echo Exporting $GHDOMAIN${SECT[0]}/${SECT[1]}/$BRANCH$FOLDER
svn export $GHDOMAIN${SECT[0]}/${SECT[1]}/$BRANCH$FOLDER
#!/usr/bin/env bash
chmod 755 $1
#!/usr/bin/env bash
git init
git add -A
git commit -m "init repo $1"
curl -u "gaurangrshah" https://api.github.com/user/repos -d "{\"name\":\"$1\"}";
sleep 10 && git remote add origin [email protected]:gaurangrshah/$1.git;
#!/usr/bin/env bash
echo "-----------------------"
if [ -z "$1"]; then
echo "-----------------------"
echo "opening typora"
open -a typora .
# echo "sorry no argument was passed"
# elif [$1 = "."]; then
else
touch "$1.md" && open -a typora "$1.md"
echo "-----------------------"
echo "success"
echo "-----------------------"
fi
#!/usr/bin/env bash
curl -u "gaurangrshah" https://api.github.com/user/repos -d "{\"name\":\"$1\"}";
sleep 10 && git remote add origin [email protected]:gaurangrshah/$1.git;
#!/usr/bin/env bash
all_args=("$@")
first_arg=$1
second_arg=$2
rest_args=("${all_args[@]:2}")
echo "${first_arg}"
echo "${second_arg}"
echo "-----------------------"
if [ -z "$rest_args" ]
then
echo "no more args"
else
# echo "${rest_args[@]:2}"
echo "-----------------------"
echo "${rest_args[@]}"
echo "-----------------------"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment