Skip to content

Instantly share code, notes, and snippets.

View justindav1s's full-sized avatar

Justin Davis justindav1s

  • Red Hat
  • United Kingdom
View GitHub Profile
oc export bc,dc,svc,route,is,serviceaccount -l template=jenkins-persistent-template --as-template=jenkins -o yaml > jenkins.yaml
---
kind: Template
apiVersion: v1
metadata:
labels:
app: mongodb
name: mongodb
annotations:
openshift.io/display-name: Deploy Mongodb
description: Deploy Mongodb
@justindav1s
justindav1s / Filesystem snapshot and restore using rsync
Last active March 22, 2018 20:57
Filesystem snapshot and restore using rsyn
snapshot / to /data1
rsync -avz \
--exclude '/dev' --exclude '/proc' --exclude '/sys' \
--exclude '/data2' --exclude '/data1' \
--exclude '/boot' --exclude '/run' \
/ /data1
tar zcvf backup_vanilla_220318.tar.gz srv/ mnt/ media/ lost+found/ usr/ sbin/ lib64/ lib bin/ opt/ home/ var/ etc/ root/ tmp/
@justindav1s
justindav1s / Ubuntu18.04 RHEL7 NVIDIA PCI
Last active May 14, 2018 20:41
Host a RHEL7.4 Guest VM on Ubuntu 18.04 with PCI passthrough for NVIDIA GPU for Deep Learning on nvidia-docker and Openshift
Links
https://medium.com/@calerogers/gpu-virtualization-with-kvm-qemu-63ca98a6a172
http://vfio.blogspot.co.uk/2015/05/vfio-gpu-how-to-series-part-1-hardware.html
#####HOST#######
Ubuntu 18.04 with functioning NVIDIA 1050 Ti.
Docker-nvidia and GPU based tensorflow all work well.
justin@justin-ubuntu:~$ lspci
@justindav1s
justindav1s / make_vm.sh
Last active May 14, 2018 20:44
make a vm with virt-install
#!/bin/bash
#PCI-passthrough doesn't work though ....
virt-install \
-n RHEL7.5_2 \
--description "virt-install test" \
--os-type=Linux \
--os-variant=rhel7 \
--ram=2048 \
#!/bin/bash
subscription-manager register
subscription-manager attach --pool=8a85f98460bfb0470160c2ff250f3e66
subscription-manager repos --disable=rhel-7-server-htb-rpms
yum update -y
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.jnd.keycloak.web.client.controllers.TokenController;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.*;
#!/bin/bash
# This script requires jq, a command line to to parse and format JSon.
# https://stedolan.github.io/jq/
function padBase64 {
STR=$1
MOD=$((${#STR}%4))
if [ $MOD -eq 1 ]; then
STR="${STR}="
#!/bin/bash
# This script requires jq, a command line to to parse and format JSon.
# https://stedolan.github.io/jq/
function padBase64 {
STR=$1
MOD=$((${#STR}%4))
if [ $MOD -eq 1 ]; then
STR="${STR}="
Log log = LogFactory.getLog(MyTokenController.class);
CloseableHttpClient httpClient
= HttpClients.custom()
.setSSLHostnameVerifier(new NoopHostnameVerifier())
.build();
HttpComponentsClientHttpRequestFactory requestFactory
= new HttpComponentsClientHttpRequestFactory();
requestFactory.setHttpClient(httpClient);