Skip to content

Instantly share code, notes, and snippets.

View bitroniq's full-sized avatar

Piotr Kowalski bitroniq

View GitHub Profile
@bitroniq
bitroniq / Jekyll.and.Liquid.Cheatsheet.md
Created February 23, 2018 16:34
Jekyll and Liquid Cheatsheet

Jekyll and Liquid Cheatsheet

A list of the most common functionalities in Jekyll (Liquid). You can use Jekyll with GitHub Pages, just make sure you are using the proper version.

Running

Running a local server for testing purposes:

@bitroniq
bitroniq / ec2-get-security-credentials-jq
Created July 18, 2019 19:56
Get AWS IAM security credentials from instance metadata, pare using jq and write to awscli environment variables and .s3cfg (for s3cmd)
#!/bin/bash
# gets iam security credentials from instance metadata and writes them to
# awscli environment variables and .s3cfg (for s3cmd)
# Usage: ec2-get-security-credentials ROLENAME DEFAULT_REGION
# ROLE=$1
# DEFAULT_REGION=$2
@bitroniq
bitroniq / ec2-get-security-credentials.sh
Last active July 18, 2019 19:58
Get AWS IAM security credentials from instance metadata on a plain EC2 or docker container and writes them to i environment variables and .s3cfg (for s3cmd)
#!/usr/bin/env sh
# First, we need to grab the name of the IAM role attached to the instance.
instance_profile=$(curl http://169.254.169.254/latest/meta-data/iam/security-credentials/)
# Alright, we’ve got the IAM role name, which we’ll now use to grab the access and secret access keys.
aws_access_key_id=$(curl http://169.254.169.254/latest/meta-data/iam/security-credentials/"${instance_profile}" | grep AccessKeyId | cut -d':' -f2 | sed 's/[^0-9A-Z]*//g')
aws_secret_access_key=$(curl http://169.254.169.254/latest/meta-data/iam/security-credentials/"${instance_profile}" | grep SecretAccessKey | cut -d':' -f2 | sed 's/[^0-9A-Za-z/+=]*//g')
aws_session_token=$(curl http://169.254.169.254/latest/meta-data/iam/security-credentials/"${instance_profile}" | grep Token | awk '{ print $3 }' | sed -e 's/^"//' -e 's/",//')
@bitroniq
bitroniq / centos-postinstall-openstack.sh
Last active November 4, 2019 11:55
OpenStack post installation script for cloud init aka userdata
#cloud-config
ssh_pwauth: True
password: techloq12
users:
- default
- name: root
- name: bitroniq
chpasswd:
list: |
root:techloq12
curl -si https://api.github.com/users/bitroniq/repos | \
grep ssh_url | cut -d '"' -f4 | xargs -i git clone {}
@bitroniq
bitroniq / .gitlab-ci.yml
Created November 19, 2020 14:08
Bash or Pipeline colors
uild1:
image: centos:7
stage: build
script:
- |
set +x
echo "Color test:"
echo "-----------"
echo -e "\033[30;1m This is ansi_bold black\033[0;m"
echo -e "\033[31;1m This is ansi_bold_red\033[0;m"
@bitroniq
bitroniq / Integrate-vim-clipboard-on-wsl.md
Last active March 6, 2021 14:48
Integrate VIM clipboard with Windows on WSL

Add this to .vimrc

if system('uname -r') =~ "Microsoft"
  augroup Yank
    autocmd!
    autocmd TextYankPost * :call system('clip.exe ',@")
  augroup END
endif
@bitroniq
bitroniq / Converting-qcow2-to-vmdk-and-vhdx.md
Last active April 8, 2021 13:39
Converting images with qemu-img convert

VM images

vGateway images extensions

  • .qcow2 - KVM type Virtual Machines
  • .vmdk - VMware and VirtualBox and ESXi
  • .vdi - VirtualBox
  • .vhdx - Microsoft Hyper-V
  • .vhd - Azure requires fixed size
@bitroniq
bitroniq / Windows10-NetworkIsolation-for-MSStore-over-OpenVPN.reg
Created April 2, 2021 16:33
Windows 10 Network Isolation for MS apps and Office 365 working over OpenVPN
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\NetworkIsolation]
"DSubnetsAuthoritive"=dword:00000001
"DomainSubnets"="100.64.0.0/12"