Skip to content

Instantly share code, notes, and snippets.

View gautamr's full-sized avatar

Gautam Roy gautamr

View GitHub Profile
PROJECT=project
PROJECT_NUMBER=1343214123423
# GKE
gcloud projects add-iam-policy-binding $PROJECT --member=serviceAccount:service-$PROJECT_NUMBER@container-engine-robot.iam.gserviceaccount.com --role=roles/container.serviceAgent
gcloud projects add-iam-policy-binding $PROJECT --member=serviceAccount:service-$PROJECT_NUMBER@containerregistry.iam.gserviceaccount.com --role=roles/editor
# Compute
gcloud projects add-iam-policy-binding $PROJECT --member=serviceAccount:[email protected] --role=roles/editor
gcloud projects add-iam-policy-binding $PROJECT --member=serviceAccount:[email protected] --role=roles/compute.serviceAgent
# APIs
@gautamr
gautamr / multi-git.sh
Last active May 12, 2018 13:35
mulple-git-account
# for personal github.com
ssh-keygen -t rsa -C "[email protected]"
# save it as id_rsa (which is default)
# for company
ssh-keygen
# save it as id_rsa_XXX (which is NOT default) when prompted
# delete cached ids
ssh-add -D
@gautamr
gautamr / mysql.sh
Last active May 12, 2018 05:21
MySQL
# https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-18-04
sudo mysql -u root
systemctl status mysql.service
sudo mysqladmin -p -u root version
@gautamr
gautamr / env.sh
Created May 11, 2018 16:41
Linux environment variables
#
@gautamr
gautamr / clojure-windows.bat
Created May 11, 2018 05:06
Install Clojure in Windows
:: This installation is applicable for installing leiningen in Windows system till date
:: #1 Create .lein folder under HOME directory
:: like C:\Users\gautamr\.lein
:: #2 Download lein.bat
:: https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein.bat
:: #3 Download standalone ZIP of latest version
:: https://github.com/technomancy/leiningen/releases/download/2.8.1/leiningen-2.8.1-standalone.zip
@gautamr
gautamr / Haskell installation - Win 7_64.txt
Last active October 13, 2017 10:12
Haskell installation - Win 7_64
#1 Download Haskell platform from https://www.haskell.org/platform/. Select 64 bit Windows version .exe
#2 Remove any previous Haskell installation - haskell home, cabal directory. Uninstall stack with uninstall-stack.exe inside C:\Users\User\AppData\Roaming\local\bin
#3 Run the installer. Don't select any PATH change autometically during installation. Not for stack also. Don't select auto creation of STACK_ROOT
#4 Create HASKELL_HOME, STACK_HOME and STACK_ROOT system variable with proper path. Add that to PATH manually.
HASKELL_HOME=C:\Haskell Platform\8.2.1
STACK_HOME=C:\Haskell Platform\stack
STACK_ROOT=C:\Haskell Platform\stack\sr
Path=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;%JAVA_HOME%\bin;%GIT_HOME%\cmd;%GIT_HOME%\bin;%M2_HOME%\bin;%GRADLE_HOME%\bin;%AMAZON_HOME%\AWSCLI\;%NPM_HOME%;%NODEJS_HOME%;%RUBY_HOME%\bin;C:\GNU\GnuPG\pub;C:\scala\bin;C:\sbt\bin;%HADOOP_HOME%\bin;%HADOOP_HOME%\sbin;%SPARK_HOME%\bin;%ATOM_HOME%\bin;%EMACS_HOME%\bin;%ASPELL
@gautamr
gautamr / lazy-fibo.clj
Created July 18, 2017 16:53
Lazy Fibonacci series in Clojure
(defn fibo [] (map first (iterate (fn [[a b]] [b (+ a b)]) [0N 1N])))
@gautamr
gautamr / tips.clj
Created July 3, 2017 12:54
Clojure Tips
;; Maps are function
(def inventors {:Lisp "McCarthy" :Clojure "Hickey"})
(inventors :List)
;; -> McCarthy
;; But if you want to get something agianst nil then use get
(get inventors :Scala "Who?")
;; -> Who?
;; keywords are function; so following two give same output
@gautamr
gautamr / jenkins_tomcat.sh
Created November 17, 2016 05:08
Jenkins Tomcat shutdown/start
#!/bin/sh
CATALINA_BASE_APPS="/home/XXX/apache/tomcat-7.0.70-instance-XXX"
APP_DIST="$WORKSPACE/XXX/XXX"
APP="XXX"
PID_FILE="$CATALINA_BASE_APPS/tomcat7-XXX.pid"
if [ -f "$PID_FILE" ]
then
echo "PID file exists: $PID_FILE"
PID=$(<"$PID_FILE")
@gautamr
gautamr / linux_commands.sh
Last active September 28, 2016 18:16
Linux commands (run on Ubuntu 14.04 LTS)
# add user; you need to set all things manually
useradd gautamr
# better to do this; home etc. will be created
adduser gautamr
# set the password for gautamr
passwd gautamr
# add sudo permission to gautamr
sudo usermod -aG sudo gautamr