Skip to content

Instantly share code, notes, and snippets.

View abdullah-shiwani's full-sized avatar
🏠
Working Remotly

Abdullah Shiwani abdullah-shiwani

🏠
Working Remotly
View GitHub Profile
@abdullah-shiwani
abdullah-shiwani / docker-compose.yaml
Last active August 13, 2018 11:01
Keycloak with postgres docker-compose
version: '3'
services:
postgres:
image: postgres:latest
restart: always
volumes:
- ./pgdata:/var/lib/postgresql/data
environment:
@abdullah-shiwani
abdullah-shiwani / percent-encoding-mapper-shim.md
Last active September 18, 2019 22:00
Special Chars URI Encoding Mapper (percent-encoding)

URI Encoding mapper of Special Charactor

Note : The special characters ".", "-", "~", and "_" remain the same

Char Encoded Value (percent-encoding)
$ %24
! %21
# %23
& %26
@abdullah-shiwani
abdullah-shiwani / java-process-memory-info.sh
Created September 19, 2019 10:16
To get the heap information a Java process.
#!/bin/bash
PID=$1
if [[ -z "${PID}" ]]; then
echo "Please provide the process id"
exit 1
fi
SIZE=`jstat -gc $PID | tail -1 | awk '{split($0,a," "); sum=(a[1]+a[2]+a[5]+a[7])/1024; print sum"MB"}'`
if [[ -z "$SIZE" ]]; then
exit 1
@abdullah-shiwani
abdullah-shiwani / java-process-memory-info.sh
Created September 19, 2019 10:17
To get the heap information a Java process.
#!/bin/bash
PID=$1
if [[ -z "${PID}" ]]; then
echo "Please provide the process id"
exit 1
fi
SIZE=`jstat -gc $PID | tail -1 | awk '{split($0,a," "); sum=(a[1]+a[2]+a[5]+a[7])/1024; print sum"MB"}'`
if [[ -z "$SIZE" ]]; then
exit 1
@abdullah-shiwani
abdullah-shiwani / kcmem.sh
Created September 19, 2019 10:17
To get the heap information a Java process. ``` bash kcmem.sh <process-id> ```
#!/bin/bash
PID=$1
if [[ -z "${PID}" ]]; then
echo "Please provide the process id"
exit 1
fi
SIZE=`jstat -gc $PID | tail -1 | awk '{split($0,a," "); sum=(a[1]+a[2]+a[5]+a[7])/1024; print sum"MB"}'`
if [[ -z "$SIZE" ]]; then
exit 1
@abdullah-shiwani
abdullah-shiwani / PostgreSQL - Readonly User
Created October 18, 2019 14:42
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;
keycloak:
replicas: 2
image:
repository: docker.local:5000/hd/keycloak
tag: 8.0.1
affinity: |
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm: