Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Modern Monk immonk

🏠
Working from home
View GitHub Profile
@immonk
immonk / Dockerfile
Last active Jul 2, 2021
Dockerfile : Stop writing your Dockerfile
View Dockerfile
# The tag here should match the Meteor version of your app, per .meteor/release
FROM geoffreybooth/meteor-base
# Copy app package.json and package-lock.json into container
COPY ./app/package*.json $APP_SOURCE_FOLDER/
RUN bash $SCRIPTS_FOLDER/build-app-npm-dependencies.sh
# Copy app source into container
COPY ./app $APP_SOURCE_FOLDER/
@immonk
immonk / install-node.sh
Created May 2, 2020
Installing nodejs in linux box
View install-node.sh
# Installing nodejs using nvm
# Download script from git
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
# Execute script & insatall nvm
. ~/.nvm/nvm.sh
# List remote versiobn
View git.sh
# clone
git clone https://github.com/VivekanandanS/jsonbase
# list branches
git branch -a
# switch to branch
git checkout master
# discard changes
@immonk
immonk / mvn.sh
Created Apr 29, 2020
Maven Cheats
View mvn.sh
# Use multiple threads for install and build
mvn -T 1C install
# clean
mvn clean
# run spring app
mvn spring-boot:run
# test
@immonk
immonk / AccountDecoder.java
Created Apr 28, 2020
Feign Custom Decoder Sample
View AccountDecoder.java
import com.google.gson.reflect.TypeToken;
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.ReadContext;
import feign.FeignException;
import feign.Response;
import feign.gson.GsonDecoder;
import net.minidev.json.JSONArray;
import net.minidev.json.JSONObject;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@immonk
immonk / postgre.sql
Created Oct 24, 2019
Postgres Utility
View postgre.sql
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
View compound-query.js
var citiesRef = db.collection("cities");
var query = citiesRef.where("capital", "==", true);
citiesRef.where("state", "==", "CA")
citiesRef.where("population", "<", 100000)
citiesRef.where("name", ">=", "San Francisco")
citiesRef
.where("state", "==", "CA")