Skip to content

Instantly share code, notes, and snippets.

@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 {
LOG_FILE=/root/installer.log
exec > >(tee -a ${LOG_FILE} )
exec 2> >(tee -a ${LOG_FILE} >&2)
@varnav
varnav / gist:7522db51b9c17fc7ee3cd6c7162368db
Last active February 25, 2022 18:50
Docker bare metal basics
Misc:
apt install mc fail2ban htop openvpn git iotop lsof
Add to /etc/sysctl.d/70-bufferbloat.conf
net.core.default_qdisc=fq
net.ipv4.tcp_fastopen=3
net.ipv4.tcp_ecn=1
net.ipv4.tcp_sack=1
XZ_OPT="--threads=4" nohup find . -maxdepth 1 -type d -mtime +1000 -exec tar --remove-files -cJf {}.tar.xz {} \; &
@varnav
varnav / new_curl_el7.yml
Created December 16, 2019 18:56
New curl for EL7 ansible
- name: Get curl {{curlver}} packages
get_url: url={{ item }} dest=/tmp/
with_items:
- https://mirror.city-fan.org/ftp/contrib/sysutils/Mirroring/curl-{{ curlver }}-2.0.cf.rhel7.x86_64.rpm
- https://mirror.city-fan.org/ftp/contrib/sysutils/Mirroring/libcurl-{{ curlver }}-2.0.cf.rhel7.x86_64.rpm
- https://mirror.city-fan.org/ftp/contrib/libraries/libmetalink-0.1.3-9.rhel7.x86_64.rpm
- https://mirror.city-fan.org/ftp/contrib/libraries/c-ares-1.15.0-4.0.cf.rhel7.x86_64.rpm
- https://mirror.city-fan.org/ftp/contrib/libraries/libssh2-1.9.0-3.0.cf.rhel7.x86_64.rpm
- https://mirror.city-fan.org/ftp/contrib/libraries/libidn-1.34-3.0.el7.x86_64.rpm
tags: curl
@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
@varnav
varnav / wifimon.sh
Last active May 14, 2019 22:56
Monitor and restart WiFi for Raspbian
#!/bin/bash
ping -c4 192.168.1.1 > /dev/null
if [ $? != 0 ]
then
d=`date`
echo "$d No network connection, restarting wlan0" >> /var/log/wifimon.txt
ifconfig wlan0 down
sleep 5
@varnav
varnav / gist:0e87701d4b6113aed3c938a1c7f1259e
Last active July 13, 2019 18:08
Merge devel to master and reset it
git checkout master
git merge --squash devel
git commit
git branch -f devel master
git push --all -f
' 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
#!/bin/sh
# Delete older than n days
find /var/spool/asterisk/monitor -mtime +75 -name '*.mp3' -delete
#Delete files smaller than n K
find /var/spool/asterisk/monitor -size -30k -name '*.mp3' -delete