Skip to content

Instantly share code, notes, and snippets.

View xynova's full-sized avatar

Hec xynova

  • Australia
View GitHub Profile
@xynova
xynova / idempotent node and bower install
Created May 19, 2015 15:10
Example of how to do idempotent apt nodejs package install and then node module
dpkg -s nodejs &> /dev/null || {
sudo apt-get -y nodejs npm
ln -s /usr/bin/nodejs /usr/bin/node
}
which bower || {
sudo npm install -g bower
}
@xynova
xynova / User friendly prompt
Last active August 29, 2015 14:21
Help your eyes finding things around so much text on the terminal
#In red Version
export PS1="\n\[\e[1;37;41m\] \u \[\e[0m\] \[\e[0;31m\]\!:\[\e[0m\]\w\[\e[0;31m\]:\[\e[0m\] "
#Or in green version
export PS1="\n\[\e[1;37;42m\] \u \[\e[0m\] \[\e[0;31m\]\!:\[\e[0m\]\w\[\e[0;31m\]:\[\e[0m\] "
@xynova
xynova / securing CoreOS etcd references
Last active October 27, 2015 10:49
Securing CoreOS etcd references
Examples with cfssl
https://coreos.com/os/docs/latest/generate-self-signed-certificates.html
https://github.com/coreos/etcd/tree/master/hack/tls-setup
Build cfssl
https://github.com/cloudflare/cfssl/blob/master/BUILDING.md
How to deploy
http://blog.skrobul.com/securing_etcd_with_tls/
https://medium.com/@gargar454/coreos-etcd-and-fleet-with-encryption-and-authentication-27ffefd0785c#.878suzplu
@xynova
xynova / docker from docker
Created December 13, 2015 13:30
run docker from docker
docker run --rm -ti -v /usr/bin/docker:/bin/docker -v /run/docker.sock:/run/docker.sock ubuntu:15.04 /bin/bash -c "apt-get -y install sqlite3 sqlite3-doc && /bin/bash"
@xynova
xynova / remove_orphaned_docker_images
Created January 23, 2016 06:25
Command to remove orphaned docker images
docker rmi $(docker images | grep <none> | tr -s ' ' _ | cut -d '_' -f 3)
@xynova
xynova / docker ps without the bloat
Created April 17, 2016 07:02
docker ps without the bloat
docker ps --format "table {{.ID}}\t{{.Image}}\t{{.Status}}\t{{.Names}}"
@xynova
xynova / openssl-create-CA.sh
Last active July 19, 2018 15:31
Create Root CA certs with openssl
# Create the Root CA private key
## ref> https://www.openssl.org/docs/manmaster/apps/genrsa.html
openssl genrsa -out myRootCA.key 4096
# Generate the Root CA certificate signed with the private key
## ref> https://www.openssl.org/docs/manmaster/apps/req.html
openssl req -x509 -new -nodes -key myRootCA.key -days 3650 -out myRootCA.pem
# Country Name (2 letter code) [AU]:AU
# State or Province Name (full name) [Some-State]:NSW
@xynova
xynova / openssl-create-TLS.sh
Last active April 25, 2021 09:19
Create TLS certs with openssl
# Create a private key for the ssl cert
## ref> https://www.openssl.org/docs/manmaster/apps/genrsa.html
openssl genrsa -out myTLS.key 2048
# Generate the TLS certificate request
## ref> https://www.openssl.org/docs/manmaster/apps/req.html
openssl req -new -key myTLS.key -out myTLS.req
# Country Name (2 letter code) [AU]:AU
# State or Province Name (full name) [Some-State]:NSW
@xynova
xynova / docker private registry mirroring.sh
Last active June 7, 2016 01:51
docker private registry mirroring
#PREPARE REGISTRY
#--------------------------------------
export REGISTRY_VERSION=2.4.0
# PULL REGISTRY
docker pull registry:${REGISTRY_VERSION}
@xynova
xynova / gulpFile.js
Last active September 24, 2016 03:32
Gulp file setup
'use strict'
var gulp = require('gulp')
, requireDir = require('require-dir')
, runSequence= require('run-sequence')
;
/* Load additional gulp tasks */
requireDir('./gulp-tasks')
/* Just run "gulp" to manually compile all the project related files */