Skip to content

Instantly share code, notes, and snippets.

@thiagoeh
thiagoeh / iam_ecs_full.json
Created March 24, 2020 20:02
ECS Full Access policy IAM HWC
{
"Version": "1.1",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ecs:*:*",
"evs:*:get",
"evs:*:list",
"evs:volumes:create",
@thiagoeh
thiagoeh / rancher_demo_cce.sh
Last active April 3, 2020 21:32
Rancher demo with Huawei CCE
# https://rancher.com/docs/rancher/v2.x/en/installation
## https://rancher.com/docs/rancher/v2.x/en/installation/other-installation-methods/single-node-docker
putty root@rancher-lab-huaweibr.mooo.com
######
curl -fsSL https://get.docker.com | sh && systemctl start docker
docker run -d --restart=unless-stopped \
-p 80:80 -p 443:443 \
rancher/rancher:latest \
# Direct connection
# @powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://gist.githubusercontent.com/thiagoeh/c845aef6e3c3372dcac29eaa876401fc/raw'))"
# With proxy
# @powershell -NoProfile -ExecutionPolicy Bypass -Command "[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials; iex ((New-Object System.Net.WebClient).DownloadString('https://gist.githubusercontent.com/thiagoeh/c845aef6e3c3372dcac29eaa876401fc/raw'))"
Write-Output "Duplicating default RDP listener"
Copy-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Destination "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-3007-Tcp" -Recurse
Write-Output "Setting port value 3007 for the new listener"
# Disable firewall
netsh advfirewall set allprofiles state off
# /openspace
http://localhost:8181/openspace/openspace.html
netsh interface portproxy add v4tov4 listenport=80 connectaddres=127.0.0.1 connectport=8181
# /amxadministrator
http://localhost:8120/amxadministrator/loginForm.jsp
netsh interface portproxy add v4tov4 listenport=8080 connectaddres=127.0.0.1 connectport=8120
# Listing external IP adresses of all running instances
aws ec2 describe-instances --query "Reservations[*].Instances[*].PublicIpAddress" --output=text
# https://docs.aws.amazon.com/cli/latest/userguide/cli-services-ec2-instances.html
aws ec2 describe-instances --filters "Name=instance-type,Values=t2.micro" --query "Reservations[].Instances[].InstanceId"
aws ec2 describe-instances --query "Reservations[].Instances[].InstanceId"
aws ec2 stop-instances --instance-ids i-0344384533d4263ab
cat /dev/urandom | tr -dc A-Z-a-z-0-9 | head -c${1:-32};echo;
apt-get update
# Download utility
apt-get install --yes --no-install-recommends curl ca-certificates
# Build tools
apt-get install --yes --no-install-recommends make pkg-config gcc
# Libraries
apt-get install --yes --no-install-recommends libwebkit2gtk-4.0-dev
@thiagoeh
thiagoeh / excel.md
Created May 2, 2018 19:15
Excel boolean based on cell color formatting
=AND(NOT(GET.CELL(63;INDIRECT("RC[-1]";FALSE)));INDIRECT("RC[-1]";FALSE)<>1;INDIRECT("RC[-1]";FALSE)<>7)
@thiagoeh
thiagoeh / pgexercises.md
Last active May 2, 2018 18:17
Running pgexercises in a container

A dedicated container for running a PostgreSQL instance for PGexercises

PostgreSQL Exercises provides exercises for learning SQL, using a Postgres instance. This is a reference on how to setup a dedicated environment using a Docker container.

Running the container

The official Docker image for Postgres will be used. Data is persisted in a named volume PGEXERCISES, mapped to the default path inside the container. We aren't defining a password, as the connection will be local (from inside the container).