Skip to content

Instantly share code, notes, and snippets.

@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)
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
cat /dev/urandom | tr -dc A-Z-a-z-0-9 | head -c${1:-32};echo;
# 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
# 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
# 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"
@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 [email protected]
######
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 \
@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 / hyper_v_on_windows_10.ps1
Last active March 27, 2020 12:23
Enable Hyper-V on Windows 10
# https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v
Get-WindowsOptionalFeature -Online -FeatureName *hyper-v* | select DisplayName, FeatureName, State
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
@thiagoeh
thiagoeh / hyper-v_nat_switch.ps1
Last active May 14, 2020 16:10
Hyper-V NAT Switch Setup
# https://docs.microsoft.com/en-us/powershell/module/hyper-v/New-VMSwitch
# https://docs.microsoft.com/en-us/powershell/module/hyper-v/Remove-VMSwitch
New-VMSwitch –SwitchName "NAT-Switch" –SwitchType Internal –Verbose
# https://docs.microsoft.com/en-us/powershell/module/netadapter/Get-NetAdapter
# https://docs.microsoft.com/en-us/powershell/module/hyper-v/Get-VMSwitch
Get-VMSwitch
Get-NetAdapter
New-NetIPAddress -IPAddress 192.168.200.1 -PrefixLength 24 -InterfaceAlias "vEthernet (NATSwitch)"