Skip to content

Instantly share code, notes, and snippets.

View hugocosme's full-sized avatar
👨‍💻
DIY

Hugo Cosme hugocosme

👨‍💻
DIY
View GitHub Profile
@hugocosme
hugocosme / docker-api-port.md
Created April 23, 2019 16:40 — forked from styblope/docker-api-port.md
Enable TCP port 2375 for external connection to Docker

Enable TCP port 2375 for external connection to Docker

See this issue.
Docker best practise to Control and configure Docker with systemd.

  1. Create daemon.json file in /etc/docker:

     {"hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"]}
    

Enable Docker Remote API with TLS client verification

Docker's Remote API can be secured via TLS and client certificate verification.
First of all you need a few certificates and keys:

  • CA certificate
  • Server certificate
  • Server key
  • Client certificate
  • Client key

Create certificate files

@hugocosme
hugocosme / gke-iam-roles.md
Created June 25, 2019 17:12 — forked from robscott/gke-iam-roles.md
GKE IAM Roles Compared

GKE IAM Roles

On GKE, there's an interesting overlap between what the IAM roles grant you for Kubernetes clusters. In general, the roles in the tables below line up with each other, but there are some strange exceptions. In each of the tables below are the results of a diff between related IAM roles (only the container.* permissions are included in these results).

Project Owner GKE Admin
container.hostServiceAgent.use
Project Editor GKE Developer
@hugocosme
hugocosme / curl-websocket.sh
Created July 12, 2019 20:06 — forked from htp/curl-websocket.sh
Test a WebSocket using curl.
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: example.com:80" \
--header "Origin: http://example.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://example.com:80/
hostname elliot-01
echo elliot-01 > /etc/hostname
bash
curl -fsSL https://get.docker.com | bash
docker version
docker ps
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
apt-get update
apt-get install kubelet kubectl kubeadm
#!/usr/bin/expect
spawn "/opt/forticlient-sslvpn/64bit/helper/setup"
expect "By typing"
send "Y\r"
#!/bin/bash
# Forticlient SSL VPN Client launching script utilizing expect.
# --------------------------------------------
# CONFIGURATION
# If empty - script will take some simple logic to locate appropriate binary.
FORTICLIENT_PATH="/opt/forticlient-sslvpn/64bit/forticlientsslvpn_cli"
#!/bin/bash
match_max 1000000
set timeout -1
echo $SERVER
expect << EOF
spawn /opt/forticlient-sslvpn/64bit/forticlientsslvpn_cli --server $SERVER --vpnuser $USER --keepalive
expect "Password for VPN:"
send -- "$PASS\r"
#send -- "\r"
set timeout -1
@hugocosme
hugocosme / docker-cleaner.sh
Last active July 27, 2020 14:25
clear docker logs
#!/bin/bash -e
#########################################################################################
##how to use: ###
##download the script "docker-cleaner.sh" adjust the permissions with chmod + x ###
##and then execute the script passing the name or ID of the container as a parameter. ###
##Eg "./docker-cleaner.sh container-name" ###
#########################################################################################
if [[ -z $1 ]]; then
echo "No container specified"

NextGen Connect (formerly known as Mirth Connect) Server Setup

Create a VM running Ubuntu. Use a modern version.

Great thanks for the original guide: https://gist.github.com/jgautsch/9157402

# Update Ubuntu
sudo apt-get update

# Upgrade Ubuntu
sudo aptitude upgrade