Skip to content

Instantly share code, notes, and snippets.

@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
@avoidik
avoidik / cloud-init-centos.yaml
Last active June 30, 2021 15:20
AWS CodeBuild Agent on Ubuntu EC2
#cloud-config
package_update: true
package_upgrade: true
packages:
- curl
- ruby
runcmd:
@avoidik
avoidik / logstash-cloudwatch.yml
Created June 17, 2021 13:07 — forked from callum-p/logstash-cloudwatch.yml
Deploys lambda functions to forward cloudwatch logs to logstash
Description: Deploys lambda functions to forward cloudwatch logs to logstash
Parameters:
coreNetworkingStackName:
Type: String
Resources:
lambdaRole:
Type: "AWS::IAM::Role"
Properties:
@avoidik
avoidik / log-forwarding-with-etw.ps1
Created June 10, 2021 12:24 — forked from ajpc500/log-forwarding-with-etw.ps1
Quick-and-dirty PowerShell script to install Sysmon (SwiftOnSecurity config), SilkService and Winlogbeat, and forward logs to HELK based on IP set in environment variable "HELK_IP" (see Line 233).
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$wc = New-Object System.Net.WebClient
if (!(Test-Path "C:\Tools")) {
New-Item -Path "C:\" -Name "Tools" -ItemType "directory"
}
# SYSMON
# Download Sysmon
$SysmonDirectory = "C:\Tools\Sysmon\"