Skip to content

Instantly share code, notes, and snippets.

# Count total EBS based storage in AWS
aws ec2 describe-volumes | jq "[.Volumes[].Size] | add"
# Count total EBS storage with a tag filter
aws ec2 describe-volumes --filters "Name=tag:Name,Values=CloudEndure Volume qjenc" | jq "[.Volumes[].Size] | add"
# Describe instances concisely
aws ec2 describe-instances | jq '[.Reservations | .[] | .Instances | .[] | {InstanceId: .InstanceId, State: .State, SubnetId: .SubnetId, VpcId: .VpcId, Name: (.Tags[]|select(.Key=="Name")|.Value)}]'
# Wait until $instance_id is running and then immediately stop it again
aws ec2 wait instance-running --instance-id $instance_id && aws ec2 stop-instances --instance-id $instance_id
# Get 10th instance in the account
@tbh639
tbh639 / mega.js
Created May 12, 2022 00:38 — forked from LI-NA/mega.js
MEGA Chrome extension was HACKED. Please remove it NOW!
// This is Chrome Mega extension script that hacked!!!
// Version is 3.39.4_0.
// You can check it from your comptuer too.
// %AppData%\Local\Google\Chrome\User Data\Default\Extensions\bigefpfhnfcobdlfbedofhhaibnlghod\3.39.4_0
// Original mega.js is here. https://github.com/meganz/chrome-extension/blob/master/mega.js
function getParameterByName(name, data) {
name = name.replace(/[\[\]]/g, '\\$&');
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), results = regex.exec(data);
if (!results) return '';
@tbh639
tbh639 / arm64.md
Created May 11, 2022 03:24 — forked from george-hawkins/arm64.md
Running virtualized x86_64 and emulated arm64 Ubuntu cloud images using QEMU

QEMU arm64 cloud server emulation

This is basically a rehash of an original post on CNXSoft - all credit (particularly for the Virtio device arguments used below) belongs to the author of that piece.

Download the latest uefi1.img image. E.g. ubuntu-16.04-server-cloudimg-arm64-uefi1.img from https://cloud-images.ubuntu.com/releases/16.04/release/

Download the UEFI firmware image QEMU_EFI.fd from https://releases.linaro.org/components/kernel/uefi-linaro/latest/release/qemu64/

Determine your current username and get your current ssh public key:

We will gather all URLs next - this may take a short while. Please remain patient.
(1) 3ddesktop -> http://desk3d.sourceforge.net/download.php
(2) 3dpong -> ftp://ftp.billsgames.com/unix/x/3dpong/src/3dpong-0.5.tar.gz
(3) 855resolution -> http://perso.orange.fr/apoirier/
(4) a2png -> http://sourceforge.net/projects/a2png/files/a2png/0.1.5/a2png-0.1.5.tar.gz
(5) a2ps -> http://ftp.gnu.org/gnu/a2ps/a2ps-4.14.tar.gz
(6) a52dec -> http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
(7) aalib -> http://sourceforge.net/projects/aa-project/files/aa-lib/1.4rc5/aalib-1.4rc5.tar.gz
(8) aamath -> http://fuse.superglue.se/aamath/aamath-0.3.tar.gz
(9) abcde -> http://abcde.googlecode.com/files/abcde-2.5.3.tar.gz
@tbh639
tbh639 / convert1.sh
Created May 4, 2022 15:53 — forked from zengxinhui/convert2arch_arm.sh
Replace Oracle Cloud Linux with Arch Linux ARM remotely
Refs:
1. http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz
2. https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/aarch64/alpine-virt-3.13.5-aarch64.iso
3. https://wiki.alpinelinux.org/wiki/Replacing_non-Alpine_Linux_with_Alpine_remotely
4. https://wiki.archlinux.org/index.php/installation_guide#Configure_the_system
5. https://archlinuxarm.org/platforms/armv8/generic
Requirement:
Console access.
@tbh639
tbh639 / convert.sh
Created May 4, 2022 06:18 — forked from zengxinhui/convert2arch_x64.sh
Replace Oracle Cloud Linux with Arch Linux remotely
Refs:
1. http://mirror.cs.pitt.edu/archlinux/iso/2021.02.01/archlinux-bootstrap-2021.02.01-x86_64.tar.gz
2. https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/x86_64/alpine-virt-3.13.1-x86_64.iso
3. https://wiki.alpinelinux.org/wiki/Replacing_non-Alpine_Linux_with_Alpine_remotely
4. https://wiki.archlinux.org/index.php/installation_guide#Configure_the_system
Requirement:
Console access.
1. In Ubuntu