Skip to content

Instantly share code, notes, and snippets.

View VojtechVitek's full-sized avatar
🏄
https://golang.cz

Vojtech Vitek (golang.cz) VojtechVitek

🏄
https://golang.cz
View GitHub Profile
$ eksctl create cluster -v 4 --name=dev3 --nodes-min=2 --nodes-max=10
2018-12-21T16:54:51Z [ℹ] using region us-west-2
2018-12-21T16:54:52Z [▶] role ARN for the current session is "arn:aws:iam::797098425712:user/vojtech"
2018-12-21T16:54:52Z [▶] determining availability zones
2018-12-21T16:54:52Z [ℹ] setting availability zones to [us-west-2c us-west-2a us-west-2b]
2018-12-21T16:54:52Z [▶] VPC CIDR (192.168.0.0/16) was divided into 8 subnets [192.168.0.0/19 192.168.32.0/19 192.168.64.0/19 192.168.96.0/19 192.168.128.0/19 192.168.160.0/19 192.168.192.0/19 192.168.224.0/19]
2018-12-21T16:54:52Z [ℹ] subnets for us-west-2c - public:192.168.0.0/19 private:192.168.96.0/19
2018-12-21T16:54:52Z [ℹ] subnets for us-west-2a - public:192.168.32.0/19 private:192.168.128.0/19
2018-12-21T16:54:52Z [ℹ] subnets for us-west-2b - public:192.168.64.0/19 private:192.168.160.0/19
2018-12-21T16:54:52Z [▶] resolving AMI using StaticGPUResolver for region us-west-2, instanceType m5.large and imageFamily AmazonLinux2
{"AWSTemplateFormatVersion":"2010-09-09","Description":"EKS cluster (dedicated VPC: true, dedicated IAM: true) [created and managed by eksctl]","Resources":{"ControlPlane":{"Type":"AWS::EKS::Cluster","Properties":{"Name":"dev3","ResourcesVpcConfig":{"SecurityGroupIds":[{"Ref":"ControlPlaneSecurityGroup"}],"SubnetIds":[{"Ref":"SubnetPublicUSWEST2C"},{"Ref":"SubnetPublicUSWEST2A"},{"Ref":"SubnetPublicUSWEST2B"},{"Ref":"SubnetPrivateUSWEST2C"},{"Ref":"SubnetPrivateUSWEST2A"},{"Ref":"SubnetPrivateUSWEST2B"}]},"RoleArn":{"Fn::GetAtt":"ServiceRole.Arn"},"Version":"1.11"}},"ControlPlaneSecurityGroup":{"Type":"AWS::EC2::SecurityGroup","Properties":{"GroupDescription":"Communication between the control plane and worker node groups","Tags":[{"Key":"Name","Value":{"Fn::Sub":"${AWS::StackName}/ControlPlaneSecurityGroup"}}],"VpcId":{"Ref":"VPC"}}},"InternetGateway":{"Type":"AWS::EC2::InternetGateway","Properties":{"Tags":[{"Key":"Name","Value":{"Fn::Sub":"${AWS::StackName}/InternetGateway"}}]}},"NATGateway":{"Type":"AWS::
@VojtechVitek
VojtechVitek / aoe2hd.md
Created March 3, 2019 23:46 — forked from yocontra/aoe2hd.md
Age of Empires II HD - For Mac OSX
@VojtechVitek
VojtechVitek / try-error-check.go
Created June 5, 2019 09:37
Proposal: try, a built-in Go error check function
func CopyFile(src, dst string) (err error) {
defer fmt.HandleErrorf(&err, "copy %s %s: %v", src, dst, err)
r := try(os.Open(src))
defer r.Close()
w := try(os.Create(dst))
defer func() {
w.Close()
if err != nil {
@VojtechVitek
VojtechVitek / toml-go.md
Last active September 16, 2019 11:11
Comparison of TOML go packages
+ TOML v0.4.0
+ MIT license
- doesn't preserve comments
- no tree structure available for recursion
- data is burried in multi-level tree of map[string]interface{}
+ preserves order in the metadata.Keys() [][]string, not very intuitive to use the metadata properly (TODO: link to example)

^ the best pkg out there, even though it's not perfect

@VojtechVitek
VojtechVitek / uninstall_vmware.sh
Created April 3, 2020 08:13 — forked from boneskull/uninstall_vmware.sh
completely uninstall vmware on mac
#!/usr/bin/env bash
# Usage: bash uninstall_vmware.bash
remove() {
entry="$1"
echo -ne "Removing \e[1;34m$entry\e[0m... "
sudo rm -rf "$entry" &> /tmp/uninstall-vmware.log
if [[ ! -e "$entry" ]]; then
echo -e "\e[1;32mOK\e[0m"
@VojtechVitek
VojtechVitek / uninstall_vmware.sh
Created April 3, 2020 08:13 — forked from boneskull/uninstall_vmware.sh
completely uninstall vmware on mac
#!/usr/bin/env bash
# Usage: bash uninstall_vmware.bash
remove() {
entry="$1"
echo -ne "Removing \e[1;34m$entry\e[0m... "
sudo rm -rf "$entry" &> /tmp/uninstall-vmware.log
if [[ ! -e "$entry" ]]; then
echo -e "\e[1;32mOK\e[0m"
@VojtechVitek
VojtechVitek / removeexcept.sh
Created April 14, 2020 12:06 — forked from olavmrk/removeexcept.sh
git filter-branch command to remove all files except those of interest
# Remove every file except "./somefile.txt" and the directory "./somedir".
# --prune-empty to remove empty commits.
git filter-branch --tree-filter "find . -not -path './.git' -not -path './.git/*' -not -path './somefile.txt' -not -path './somedir/*' -not -path './somedir' -delete" --prune-empty
@VojtechVitek
VojtechVitek / gist:452b7f692197e765c6fc323366bd040a
Created May 15, 2020 14:20 — forked from madis/gist:4650014
Testing CORS OPTIONS request with curl
curl -v -X OPTIONS -H 'Access-Control-Request-Method: GET' -H 'Access-Control-Request-Headers: Origin, Accept, Content-Type' -H 'Origin: https://origin-host.example.com' https://target-host.example.com/ping
@VojtechVitek
VojtechVitek / mask2cdr
Created December 7, 2020 21:03 — forked from RichardBronosky/mask2cdr
Convert netmask to CIDR
#!/bin/bash
# Based on https://stackoverflow.com/questions/20762575/explanation-of-convertor-of-cidr-to-netmask-in-linux-shell-netmask2cdir-and-cdir
mask2cdr ()
{
local mask=$1
# In RFC 4632 netmasks there's no "255." after a non-255 byte in the mask
local left_stripped_mask=${mask##*255.}
local len_mask=${#mask}