Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Sumit Sahoo sumitsahoo

🏠
Working from home
View GitHub Profile
@sumitsahoo
sumitsahoo / add_permission.sh
Last active Sep 28, 2020
Fix brew permission from another account in macOS
View add_permission.sh
# First create a user group and add users who are going to use shared brew
# User group : brew-usergroup
echo $(brew --prefix)
echo $(groups $(whoami))
sudo dseditgroup -o edit -a $(whoami) -t user brew-usergroup
sudo chgrp -R brew-usergroup $(brew --prefix)/*
sudo chmod -R g+rwX $(brew --prefix)/*
ls -lah $(brew --prefix)
@sumitsahoo
sumitsahoo / JsonValidator.java
Created Jul 29, 2020
Check if a string is a valid JSON
View JsonValidator.java
private static boolean isJson(String Json) {
try {
new JSONObject(Json);
} catch (JSONException ex) {
try {
new JSONArray(Json);
} catch (JSONException ex1) {
return false;
}
}
@sumitsahoo
sumitsahoo / Dockerfile
Last active Jul 15, 2020
Start strapi in dev configuration
View Dockerfile
# Use the official lightweight Node.js image.
# https://hub.docker.com/_/node
FROM node:14.5.0-slim
# Create and change to the app directory.
WORKDIR /usr/src/app
# Set PROD/DEV environment
ENV NODE_ENV=development
#ENV NODE_ENV=production
@sumitsahoo
sumitsahoo / see_user_tables.sql
Created Jul 15, 2020
See all user defined tables in PostgreSQL
View see_user_tables.sql
SELECT
*
FROM
pg_catalog.pg_tables
WHERE
schemaname != 'pg_catalog'
AND schemaname != 'information_schema';
@sumitsahoo
sumitsahoo / update_brew.sh
Created Jun 24, 2020
Update brew and cleanup
View update_brew.sh
brew update && brew upgrade && brew cleanup
@sumitsahoo
sumitsahoo / Util.kt
Created Jun 24, 2020
Make status bar transparent
View Util.kt
fun makeStatusbarTransparent(activity: AppCompatActivity) {
activity.window.apply {
clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
statusBarColor = Color.TRANSPARENT
}
}
@sumitsahoo
sumitsahoo / sonarqube-postgres-docker.md
Created Jun 22, 2020 — forked from ceduliocezar/sonarqube-postgres-docker.md
How easily run Sonar Qube and PostgresSQL with Docker Containers
View sonarqube-postgres-docker.md

TL;DR

After installing Docker, follow three steps:
Step 1:
Run: docker network create mynet

Step 2:
Run: docker run --name sonar-postgres -e POSTGRES_USER=sonar -e POSTGRES_PASSWORD=sonar -d -p 5432:5432 --net mynet postgres

Step 3:
Run: docker run --name sonarqube -p 9000:9000 -e SONARQUBE_JDBC_USERNAME=sonar -e SONARQUBE_JDBC_PASSWORD=sonar -e SONARQUBE_JDBC_URL=jdbc:postgresql://sonar-postgres:5432/sonar -d --net mynet sonarqube:5.6

@sumitsahoo
sumitsahoo / uninstall_app.kt
Created Jun 1, 2020
Uninstall app using package name
View uninstall_app.kt
// Add below permission to AndroidManifest.xml file
// <uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
// After that use below code to uninstall an app
val intent = Intent(Intent.ACTION_DELETE)
intent.data = Uri.parse("package:com.sumit.demo")
startActivity(intent)
@sumitsahoo
sumitsahoo / remove_jdk.sh
Created May 13, 2020
Remove JDK from macOS
View remove_jdk.sh
sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefPane
sudo rm -rf /Library/Application\ Support/Oracle/Java/
sudo rm -rf /Library/Java/JavaVirtualMachines
View android_material_design_colours.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>
You can’t perform that action at this time.