Skip to content

Instantly share code, notes, and snippets.

View vazhnov's full-sized avatar

Alexey Vazhnov vazhnov

View GitHub Profile
@glowinthedark
glowinthedark / generate_directory_index_caddystyle.py
Last active February 16, 2024 21:58
Generate directory index (recurse subfolders with `-r` or `--recursive`). Use `-h` or `--help` for all options ❗️superseded by https://github.com/glowinthedark/index-html-generator
#!/usr/bin/env python3
# NOTE: this script is deprecated;
# maintained version with SVG icons: https://github.com/glowinthedark/index-html-generator/
# ---
# Copyright 2020 glowinthedark
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@alukach
alukach / parse-inventory-progress.py
Last active October 6, 2023 18:40
Parsing S3 Inventory results in Python
#! /usr/bin/env python3
"""
A utility to stream records from one or many S3 Inventory reports, with a progress bar.
./parse-inventory-progress s3://my-bucket/path/to/my/inventory/2019-12-15T00-00Z/manifest.json > out.csv
"""
import json
import csv
import gzip
import sys
@superboum
superboum / LICENCE.txt
Last active May 29, 2024 19:09
Install Debian with Debootstrap + Grub EFI
MIT LICENSE
Copyright 2018 Quentin Dufour
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH
@lategoodbye
lategoodbye / net-smsc95xx-Fix-max-MTU-value.patch
Created September 1, 2018 19:37
net: smsc95xx: Fix max MTU value
From 3e7125490ca5c317f6d7b39c727018fb48cc31df Mon Sep 17 00:00:00 2001
From: Stefan Wahren <stefan.wahren@i2se.com>
Date: Sat, 1 Sep 2018 16:10:41 +0200
Subject: [PATCH] net: smsc95xx: Fix max MTU value
The commit f77f0aee4da4 ("net: use core MTU range checking in USB NIC
drivers") introduce a common MTU handling for usbnet. But it's missing
the necessary changes for smsc95xx. So set the max MTU to 1500.
This patch has been tested on a Raspberry Pi 3.
@dpneumo
dpneumo / diff-phone_home.py.txt
Last active February 18, 2022 08:18
Modify cloud-init phone_home module to return a created server's public key for insertion into known_hosts. Works with cloud-iniit version 0.7.9 and later.
# Diff of the original cc_phone_home and the slightly modified version that supports
# including the server pub_keys in the phone_home payload
# Original: https://github.com/number5/cloud-init/blob/master/cloudinit/config/cc_phone_home.py
# A couple of typos in comment lines in the original were elided to make the diff a bit clearer.
# The Centos7 distros I am using do not provide pub_key_dsa.
# I am talking to a Rails app with phone_home.
# A dummy X-CSRF-Token: 1234567890 in the headers simplifies the code on the Rails side.
# I authenticate the phone_home payload by including a token provided in the
Jenkinsfile VIM syntax highlighting
echo 'au BufNewFile,BufRead Jenkinsfile setf groovy' >> ~/.vimrc
@vazhnov
vazhnov / remove_oldest_files.sh
Last active February 2, 2022 06:22
Remove oldest .tgz files, if free space less than 50GB
#!/usr/bin/env bash
# set -o nounset
set -o errexit
shopt -s dotglob
# Remove oldest .tgz files, if free space less than 50GB
#
# License: CC0 1.0 or newer
# https://creativecommons.org/publicdomain/zero/1.0/
#
@kgmoore431
kgmoore431 / delete_iam_user.sh
Created June 2, 2017 05:35
Delete an IAM user with AWS CLI
#!/bin/bash
user_name="$1"
echo "Removing user: ${user_name}"
echo "Deleting Access Keys:"
keys=("$(aws iam list-access-keys --user-name "${user_name}" | jq -r '.AccessKeyMetadata[] | .AccessKeyId')")
if [[ "${#keys}" -gt "0" ]]; then
# shellcheck disable=SC2068
@charlessolar
charlessolar / gist:515016139f0014cdfc029c7dd553d597
Last active January 13, 2020 11:54
ansible inventory files from terraform
### variables
variable "env" {}
variable "riak_count" {}
variable "elastic_count" {}
### hostname.tpl
${name}-${env}-${format("%02s",index)} ${extra}
### ansible.tpl
Disk encryption benchmarks:
$ cryptsetup benchmark
# Tests are approximate using memory only (no storage IO).
PBKDF2-sha1 352344 iterations per second
PBKDF2-sha256 196215 iterations per second
PBKDF2-sha512 156784 iterations per second
PBKDF2-ripemd160 237449 iterations per second
PBKDF2-whirlpool 73470 iterations per second
# Algorithm | Key | Encryption | Decryption