Skip to content

Instantly share code, notes, and snippets.

@kat47
kat47 / audio-test.html
Created March 9, 2024 11:47
Audio Test
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
</head>
<body>
<script src="audio-test.js"></script>
</body>
@kat47
kat47 / stop-instances.py
Created April 15, 2022 14:07
Python script to stop all running instances in a region (AWS)
import boto3
ec2 = boto3.client('ec2')
response = ec2.describe_instances()
for reservation in response["Reservations"]:
for instance in reservation["Instances"]:
if instance["State"]["Name"] == "running":
print("Stopping instance: " + instance["InstanceId"])
ec2.stop_instances(InstanceIds=[instance["InstanceId"]])
print("Instance stopped: " + instance["InstanceId"])
else:
@kat47
kat47 / Commands.md
Last active May 24, 2021 13:57
Windows Powershell eqivalent of Linux Commands
@kat47
kat47 / misc.md
Created March 15, 2021 20:52
Misc Linux Commands

Get file permissions Linux

In octal

stat -c "%a %n" /path/to/folder/or/file

$ stat -c "%a %n" nginx.conf
644 nginx.conf
@kat47
kat47 / sshkeepalive.md
Last active March 14, 2021 09:35
SSH Keep Alive

How to prevent SSH session from disconnection too soon due to inactivity

Make use of the "ServerAliveInterval" option

ssh user@hostname -o ServerAliveInterval=300

To use by default you can create an Alias

alias sshlive='ssh -o ServerAliveInterval=300'

@kat47
kat47 / Linux.md
Last active March 14, 2021 09:22
Some Networking oriented Linux Commands

Iperf3

Install

sudo apt-get install iperf3

sudo yum install iperf3 -y

Usage - TCP

#!/bin/bash
sudo apt-get install gnupg1 apt-transport-https dirmngr
export INSTALL_KEY=379CE192D401AB61
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $INSTALL_KEY
echo "deb https://ookla.bintray.com/debian generic main" | sudo tee /etc/apt/sources.list.d/speedtest.list
sudo apt-get update
sudo apt-get install speedtest