Skip to content

Instantly share code, notes, and snippets.

View gyfoster's full-sized avatar

Grant Foster gyfoster

View GitHub Profile
# get name of device
lsblk
file -s /dev/<device-name>
# replace xfs if different file system type
mkfs -t xfs /dev/<device-name>
mkdir /ebs1
mount /dev/<device-name> /ebs1
# Run these commands after increasing the size of your volume in the AWS console to use the new space.
# list storage usage by volume
df -h
# let's say the filled up volume is called /dev/mapper/VolGroup00-rootVol
# list block devices to get the name of the filled up block device
lsblk
# let's say VolGroup00-rootVol is under nvme0n1p2
Edit value in properties file
$ propsFile="/opt/myapp/application.properties"
$ sed -i "s/\(server\.port\=\).*\$/\1New Text Here/" $propsFile
##################################
# Based on https://medium.com/@dale.bingham_30375/setup-geoserver-for-a-local-gis-application-like-cesiumjs-14322f1178d5
##################################
# Exit when any command fails
set -e
# Check if being run as root
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
@gyfoster
gyfoster / osm-tile-server-setup.sh
Last active November 29, 2019 22:06
A script for setting up an OSM tile server from scratch
#!/bin/bash
##########################################################################################
# Run on Ubuntu Server 18.04
# Assumes *.tar.gz files are in the same dir as script
# - osm2pgsql.tar.gz from `git clone git://github.com/openstreetmap/osm2pgsql.git`
# - mod_tile.tar.gz from `git clone -b switch2osm git://github.com/SomeoneElseOSM/mod_tile.git`
# - openstreetmap-carto.tar.gz from `git clone git://github.com/gravitystorm/openstreetmap-carto.git`
# - map_data.tar.gz from `wget http://download.geofabrik.de/asia/azerbaijan-latest.osm.pbf`
# - shapefile_data.tar.gz from openstreetmap-carto/scripts/get-shapefiles.py
@gyfoster
gyfoster / dockerfile-full-group-access.txt
Created April 18, 2019 20:55
For giving the group full access
For giving the group full access, use:
RUN umask 0002
@gyfoster
gyfoster / deploy-app-to-wildfly.bat
Last active April 16, 2019 20:31
A CLI script for deploying an app to a local WildFly server
@echo off
IF EXIST "C:\wildfly\standalone\deployments\myapp.jar*" (
del "C:\wildfly\standalone\deployments\myapp.jar*"
)
IF EXIST "C:\myapp\target\myapp.jar" (
copy C:\myapp\target\myapp.jar C:\wildfly\standalone\deployments\
)
echo. & echo Deploy complete!
pause
@gyfoster
gyfoster / keycloak-wildfly-mutual-ssl.txt
Last active February 17, 2023 08:47
Instructions for enabling mutual SSL in Keycloak and WildFly
ROOT CA
--------------
Generate the CA private key:
$ openssl genrsa -out ca.key 2048
Create and self sign the root certificate:
$ openssl req -new -x509 -key ca.key -out ca.crt
Import root CA certificate into truststore:
$ keytool -import -file ca.crt -keystore ca.truststore -keypass <password> -storepass <password>
@gyfoster
gyfoster / postgres-notes.txt
Created April 8, 2019 16:11
A list of useful Postgres commands
Log into postgres via command line:
$ psql -h <host> -p <port> -U <username> -d <database>
Run script from command line:
$ psql -h <host> -p <port> -U <username> -d <database> -f <sql-script>
@gyfoster
gyfoster / dos-to-unix.sh
Created April 8, 2019 16:07
Converts dos line endings to unix line endings if dos2unix is unavailable
# do NOT use same file for infile and outfile - will result in data loss
tr -d '\r' < infile > outfile