Skip to content

Instantly share code, notes, and snippets.

View gyfoster's full-sized avatar

Grant Foster gyfoster

View GitHub Profile
@gyfoster
gyfoster / virtualbox-centos7-setup.txt
Last active April 8, 2019 14:46
Instructions for setting up a CentOS 7 VM in VirtualBox
CentOS 7 in VirtualBox Setup
VirtualBox VM settings:
1. General —> Advanced
1. Shared Clipboard: Bidirectional
2. Drag’n’Drop: Bidirectional
2. System —> Motherboard
1. Base Memory: max out green
2. Pointing Device: USB Tablet
3. System —> Processor —> Processor(s): max out green
@gyfoster
gyfoster / adjust-resolution.sh
Created April 7, 2019 03:26
Works with Gnome and XFCE desktops
xrandr --newmode "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync
xrandr --addmode Virtual1 1920x1080_60.00
xrandr --output Virtual1 --mode 1920x1080_60.00
@gyfoster
gyfoster / openshift-cleanup.sh
Last active April 8, 2019 14:35
Deletes all OpenShift resources pertaining to "my-app"
oc delete imagestream my-app
oc delete buildconfig my-app
oc delete dc my-app
oc delete service my-app
oc delete imagestream my-app
oc delete route my-app
@gyfoster
gyfoster / openshift-migration.sh
Last active April 8, 2019 14:36
For migrating resources from one OpenShift instance to another
if [ $# -eq 0 ]; then
echo "No new project name specified. Exiting."
exit 1
fi
read -p "OpenShift username: " username
read -s -p "OpenShift password: " password
mkdir openshift-mig-temp
@gyfoster
gyfoster / docker-clean.sh
Last active April 8, 2019 15:15
Deletes all local Docker containers and images
# stop all containers
docker stop $(docker ps -a -q)
# delete stopped containers
docker rm $(docker ps -a -q)
# delete all images
docker rmi -f $(docker images -q)
@gyfoster
gyfoster / common-openshift-commands.txt
Last active April 8, 2019 15:15
A list of commonly used OpenShift CLI commands
Roll back deployment to previous version:
$ oc rollback <app-name> --to-version=<deployment-num>
Get access to pod where it fails:
$ oc debug <pod-name>
Create image stream from image in external registry:
$ oc import-image <image-name> --from=nexus.my-domain.com:5000/<image-name> --confirm
View logs relating to build:
@gyfoster
gyfoster / common-docker-commands.txt
Last active January 13, 2021 17:08
A list of commonly used Docker commands
List all containers:
$ docker ps -a
Get shell in running container:
$ docker exec -it <container name> /bin/bash
Stop a specific container:
$ docker stop <container-id>
Stop all running containers:
@gyfoster
gyfoster / set-request-header-ajax.js
Last active April 8, 2019 16:11
Adds a custom header to an HTTP request
$.ajax({
beforeSend: function(request) {
request.setRequestHeader("APP_USER", "CN=TestUser1, OU=My Org Unit, O=My Org, C=US");
},
url: "/app/rest/list/ADMIN_TYPE",
success: function(data) {
console.log(data);
}
});
@gyfoster
gyfoster / curl.txt
Last active April 8, 2019 15:43
A list of my most commonly used curl commands
Use '\' to escape '!'
Upload
$ curl -k -v -u myuser:mypassword --upload-file test.zip https://nexus.my-domain.com:9443/repository/binary-artifact-repository/test.zip
Download
$ curl -k -v -O -u myuser:mypassword https://nexus.my-domain.com:9443/repository/binary-artifact-repository/test.zip
@gyfoster
gyfoster / find.txt
Last active April 8, 2019 15:44
A list of my most commonly used find commands
Find file (case-insensitive) with name beginning with "postgres" in current directory:
$ find . -iname postgres*
Find directory (case-insensitive) in filesystem with name "s2i":
$ sudo find / -type d -iname "s2i"
Find text within a set of files in current directory:
$ find . -iname *.java | xargs grep -i someTextToSearchFor