Skip to content

Instantly share code, notes, and snippets.

@varnav
varnav / adsb-feed-rpi.sh
Last active March 26, 2024 19:31
Script will install multiple ADS-B feeders to Raspberry Pi OS
#!/bin/bash -ex
# Script will install multiple ADS-B feeders to Raspberry Pi OS
# Before running make sure you have your coordinates (lat/lon in a form of DD.DDDD) and antenna height (in both feet and m) handy.
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
@varnav
varnav / adusers_weblist.php
Last active January 7, 2024 10:24
Web table listing active directory users
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Список сотрудников</title>
<style>
a {text-decoration : none}
a:link {color : #000000}
@varnav
varnav / windows_winrm_http.tf
Last active January 4, 2024 15:58
Windows VM with HTTPS WinRM Terraform
resource "azurerm_key_vault_certificate" "main" {
name = "${terraform.workspace}-winrmcert"
key_vault_id = var.key_vault_id
certificate_policy {
issuer_parameters {
name = "Self"
}
key_properties {
@varnav
varnav / adsb-feed-arm64.sh
Last active December 14, 2023 15:17
Install ADS-B feeders for arm64 arch
#!/bin/bash -ex
# Script will install multiple ADS-B feeders to ARM64 microcomputers like Orange Pi
# Before running make sure you have your coordinates (lat/lon in a form of DD.DDDD) and antenna height (in both feet and m) handy.
# https://discussions.flightaware.com/t/package-install-of-piaware-ver-7-2-on-arm64-aarch64-and-amd64-x86-64-machines/81136/4
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
@varnav
varnav / chef_tmp_partition_cis.rb
Last active December 6, 2023 22:49
chef_tmp_partition_cis.rb
# 1.1.4 Ensure nodev option set on /tmp partition
# 1.1.5 Ensure nosuid option set on /tmp partition
if node['filesystem']['by_mountpoint']['/tmp'] and node['platform_version'] >= 7
mount '/tmp' do
device node['filesystem']['by_mountpoint']['/tmp']['device']
fstype node['filesystem']['by_mountpoint']['/tmp']['fs_type']
# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/storage_administration_guide/sect-using_the_mount_command-mounting
options 'defaults,noquota,nodev,nosuid'
action [:remount, :enable]
end
function Get-WindowsKey {
## function to retrieve the Windows Product Key from any PC
## by Jakob Bindslet (jakob@bindslet.dk)
param ($targets = ".")
$hklm = 2147483650
$regPath = "Software\Microsoft\Windows NT\CurrentVersion"
$regValue = "DigitalProductId4"
Foreach ($target in $targets) {
$productKey = $null
$win32os = $null
@varnav
varnav / ubuntu-docker.sh
Last active July 21, 2023 13:12
Docker on Ubuntu installation
apt update
apt remove docker docker-engine docker.io containerd runc
apt install -y apt-transport-https ca-certificates curl software-properties-common gnupg curl lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
apt update
apt install -y docker-ce docker-ce-cli containerd.io mc fail2ban htop git iotop lsof ufw docker-compose
systemctl status docker
ufw allow ssh
' DESCRIPTION:
' This script will backup bitlocker recovery information to active directory for drives which are already encrypted.
' DEVELOPED BY:
' Himanshu Singh (himanshu.singh@microsoft.com)
' Microsoft Corporation
' Patched by Evgeny Varnavskiy
' Sep 2018
@varnav
varnav / acars-feed.sh
Last active June 3, 2023 21:04
This script will install number of feeders to receive, decode and feed ACARS and VDL messages
#!/bin/bash -ex
# This script will install number of feeders to receive, decode and feed ACARS and VDL messages
# Optimized for Raspberry Pi
# See: https://app.airframes.io/about
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
@varnav
varnav / pagespeed_optimize_images.sh
Last active June 14, 2022 07:46 — forked from julianxhokaxhiu/pagespeed_optimize_images.sh
Recursively optimize all PNG and JPG files
#!/bin/bash
# https://code.luasoftware.com/tutorials/linux/command-line-optimize-image/
find . -type f -iname '*.png' -exec pngquant --skip-if-larger --ext .png --force 256 {} \;
find . -type f -iname "*.png" | xargs optipng -o2 -strip all
find . -name '*.png' -print0 | xargs -0 -n1 -I{} sh -c 'zopflipng {} output.png; [ -f output.png ] && mv output.png {};'
# Using -print0 to deal with spaces
find . -print0 -type f -name "*.jpg" -o -name "*.JPG" | xargs -0 jpegoptim