Skip to content

Instantly share code, notes, and snippets.

@avoidik
avoidik / FreeBSD-11-ec2-cloudwatch.md
Created September 29, 2021 15:52 — forked from pacohope/FreeBSD-11-ec2-cloudwatch.md
FreeBSD 11 on AWS EC2, with CloudWatch Logs and EC2 Metrics

Introduction

This is how you would create a livable FreeBSD instance on EC2 by hand. The smart thing to do is to automate most of these actions. But I do it this way so you can see and understand all the different techniques. I want to create FreeBSD instances in EC2 and I want some of the management benefits that come from native AWS technologies like CloudWatch. It can be done, but it takes a bit of extra work because FreeBSD isn't Linux, and AWS doesn't directly support FreeBSD.

Prepping in AWS land

Before we go far, we will want some things setup in AWS IAM and VPC. I assume you have already created a VPC, decided what network numbers you're going to use, created a subnet and so on. If you haven't done those basic things, you need to go do them. I also assume you've created an ssh key and uploaded it to your AWS account.

- name: CALICO_IPV4POOL_CIDR
value: "172.16.0.0/16"
- name: IP_AUTODETECTION_METHOD
value: "interface=eth1"
@avoidik
avoidik / config
Created September 18, 2021 12:44
VirtualHere USB Client on Ubuntu
[Transport]
PingInterval=3
PingTimeout=10
CompressionLimit=384
EasyFindId=xxx
EasyFindPin=zzz
[General]
MainFrameWidth=640
MainFrameHeight=480
SSLClientCert=
@avoidik
avoidik / README.md
Last active January 31, 2023 21:08
HiDPI Scaling in Ubuntu

How to change DPI

Some applications do not properly handle fractional scaling after xrandr, in my case I'm using Mate environment

$ cat /etc/X11/Xsession.d/45xrandr-custom
if [ "x$DESKTOP_SESSION" = "xmate" ] || [ "x$XDG_SESSION_DESKTOP" = "xmate" ]; then
    /usr/bin/xrandr --output eDP-1 --scale 1.5x1.5 --brightness 0.7 --mode 1920x1080
fi
@avoidik
avoidik / NOTE.md
Created September 4, 2021 20:45
Scheduling mechanics available in Kubernetes
@avoidik
avoidik / download.sh
Created September 4, 2021 20:06
Install weave-net
#!/bin/bash
curl -fsSLo weave-daemonset.yaml "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')&env.IPALLOC_RANGE=10.32.0.0/16"
@avoidik
avoidik / iptables-ns.sh
Last active October 21, 2022 06:29
Linux Network Namespaces
#!/bin/bash
flag_iptables=true
flag_dry_run=true
while getopts ":nf" arg; do
case $arg in
n) # Dry-run - does not preserve iptables rules.
flag_dry_run=false
;;
@avoidik
avoidik / Uninstall-Pester.ps1
Created July 31, 2021 18:11 — forked from nohwnd/Uninstall-Pester.ps1
Remove built-in version of Pester 3 (or -All) from Windows 10 Program Files and Program Files (x86).
#Requires -RunAsAdministrator
function Uninstall-Pester ([switch]$All) {
if ([IntPtr]::Size * 8 -ne 64) { throw "Run this script from 64bit PowerShell." }
#Requires -RunAsAdministrator
$pesterPaths = foreach ($programFiles in ($env:ProgramFiles, ${env:ProgramFiles(x86)})) {
$path = "$programFiles\WindowsPowerShell\Modules\Pester"
if ($null -ne $programFiles -and (Test-Path $path)) {
if ($All) {
@avoidik
avoidik / get_eks_token.py
Created July 31, 2021 16:24
Retrieve AWS EKS token using Python
import base64
import boto3
import re
from botocore.signers import RequestSigner
def get_bearer_token(cluster_id, region):
STS_TOKEN_EXPIRES_IN = 60
session = boto3.session.Session()
client = session.client('sts', region_name=region)
@avoidik
avoidik / powerline-go.sh
Created July 2, 2021 20:28
powerline-go configuration
INTERACTIVE_BASHPID_TIMER="/tmp/${USER}.START.$$"
PS0='$(echo $SECONDS > "$INTERACTIVE_BASHPID_TIMER")'
function _update_ps1() {
local __ERRCODE=$?
local __JOBS=$(jobs -p | wc -l)
local __DURATION=0
if [ -e $INTERACTIVE_BASHPID_TIMER ]; then
local __END=$SECONDS