Skip to content

Instantly share code, notes, and snippets.

View ao's full-sized avatar
😶‍🌫️

Andrew O ao

😶‍🌫️
View GitHub Profile
@ao
ao / ubuntu_devops_tools_quickstart.sh
Last active July 30, 2024 08:33
ubuntu_devops_tools_quickstart.sh
#!/bin/bash
apt install jq -y
# Install Terraform (latest version)
LATEST_TF_VERSION=$(curl -s https://api.github.com/repos/hashicorp/terraform/releases/latest | jq -r '.tag_name')
curl -LO "https://releases.hashicorp.com/terraform/${LATEST_TF_VERSION#v}/terraform_${LATEST_TF_VERSION#v}_linux_amd64.zip"
unzip "terraform_${LATEST_TF_VERSION#v}_linux_amd64.zip"
sudo mv terraform /usr/local/bin/
rm "terraform_${LATEST_TF_VERSION#v}_linux_amd64.zip"
@ao
ao / resize.sh
Last active July 29, 2024 13:03
Resize script for AWS Cloud9 instances
#!/bin/bash
# Specify the desired volume size in GiB as a command line argument. If not specified, default to 50 GiB.
SIZE=${1:-50}
# Get the ID of the environment host Amazon EC2 instance.
TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 60")
INSTANCEID=$(curl -s -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/instance-id 2> /dev/null)
REGION=$(curl -s -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/placement/region 2> /dev/null)
@ao
ao / generate-ssh-key.sh
Created February 4, 2020 19:16 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/mozilla_rsa
@ao
ao / office2016.txt
Created July 17, 2019 08:41 — forked from Dhanvesh/office2016.txt
Microsoft Office 2016 Activation code
@echo off
title Activate Microsoft Office 2016 ALL versions for FREE!&cls&echo ============================================================================&echo #Project: Activating Microsoft software products for FREE without software&echo ============================================================================&echo.&echo #Supported products:&echo - Microsoft Office Standard 2016&echo - Microsoft Office Professional Plus 2016&echo.&echo.&(if exist "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles%\Microsoft Office\Office16")&(if exist "%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles(x86)%\Microsoft Office\Office16")&(for /f %%x in ('dir /b ..\root\Licenses16\proplusvl_kms*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&(for /f %%x in ('dir /b ..\root\Licenses16\proplusvl_mak*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&echo.&echo ============================================================================&ech
@ao
ao / decode_firmware_pwd.py
Created September 30, 2018 16:54 — forked from nathany/decode_firmware_pwd.py
Decode Mac Open Firmware Password
# I forgot the firmware password on my MacBook Air and didn't want to take it in:
# http://support.apple.com/kb/TS2391
# info
# http://paulmakowski.blogspot.com/2009/03/apple-efi-firmware-passwords.html
# run the following command to retrieve your obfuscated firmware password:
# sudo nvram -p | grep security-password
security_password = "%..."
# take the complement of every second bit:
@ao
ao / python_counting_lists.py
Created September 25, 2018 12:25
Counting in Python using lists
# Counting in Python using lists
# by Andrew Odendaal (https://ao.gl/counting-in-python-using-a-list/)
magic = 0x616f-0x414f
numbers = [
(magic/0x186A0),
(magic/0x3E8/8),
(magic/0x3E8/4),
(magic/0o1534-7),
@ao
ao / gist:8a581b0aa4b0ad7e0b7ea865fa03a091
Created August 24, 2018 11:46
Automatic mouse mover (in python)
from pynput.mouse import Button, Controller
import time
mouse = Controller()
mouse.position = (0, 0)
mouse.move(50, 50)
for i in range(1000):
mouse.move(75, 75)
time.sleep(1)
@ao
ao / Working Digital Ocean Promotional Codes for January, February, March, April and May 2018.md
Last active February 2, 2018 00:02
Working Digital Ocean Promotional Codes for January, February, March, April and May 2018

Working Digital Ocean Promotional Codes for January, February, March, April and May 2018

Want a Discount?

  1. Sign up with this link to save your first $10!
  2. Use one of the Promocodes below to save an additional $10-$15
  • LOWENDBOX (<- worth the most ($15)!)
  • DODEPLOY (<- $10)
@ao
ao / javascript.js
Created October 29, 2016 18:03
Codility: A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N.
function solution(N) {
var binary = N.toString(2);
var length = binary.length;
var ones = [];
for(var i=0; i<length; i++) {
if (binary[i]=='1') ones.push(i);
}
@ao
ao / getServer.py
Last active October 26, 2016 10:11
Python: Identify/Get the hosting Server from a list of domain names (commandline)
import sys
import requests
import random
from multiprocessing.dummy import Pool as ThreadPool
'''
Usage:
$ python server.py random 25
$ python server.py google.com