Skip to content

Instantly share code, notes, and snippets.

@ejdoh1
ejdoh1 / run.sh
Last active August 11, 2019 01:57
Azure az login using proxy on macbook
# The following script fixes the following error when running az login behind a network proxy
# ---------------------
# az login
# Note, we have launched a browser for you to login. For old experience with device code, use "az login --use-device-code"
# Please ensure you have network connection. Error detail: HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /common/oauth2/token (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x103650ed0>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))
# ---------------------
set +H #if your password contains '!'
export http_proxy="<domain\username>:<password>@<proxy server URL>:<port>"
export https_proxy=“<proxy server URL>:<port>”
@ejdoh1
ejdoh1 / sample.py
Created September 21, 2019 13:26
Desko change desk colour sample
#!/usr/bin/python3
import requests
import json
CLIENT_ID = '<CLIENT_ID>'
CLIENT_SECRET = '<CLIENT_SECRET>'
TOKEN_URL = 'https://desko.auth.ap-southeast-2.amazoncognito.com/oauth2/token'
DESK_COLOUR_URL = 'https://desko.planternal.com/api/desk/colour'
COLOUR = {
'red': 0,
@ejdoh1
ejdoh1 / get_access_token.js
Created November 26, 2019 06:46
How to get an access_token from AWS Cognito using Axios
// Get AWS Congito access token using node-fetch and axios
const axios = require('axios');
const fetch = require('node-fetch');
const url = 'https://REPLACE_ME.auth.ap-southeast-2.amazoncognito.com/oauth2/token';
const clientId = 'REPLACE_ME';
const clientSecret = 'REPLACE_ME';
const body = `client_id=${clientId}&client_secret=${clientSecret}&grant_type=client_credentials`
// with node-fetch
@ejdoh1
ejdoh1 / copy_one_dynamodb_table_to_another.py
Created December 18, 2019 12:05
Copy one AWS DynamoDB table to another
import boto3
ddb = boto3.Session(region_name='REPLACE_ME',profile_name='REPLACE_ME').resource('dynamodb')
tbl_from = ddb.Table('REPLACE_ME')
tbl_to = ddb.Table('REPLACE_ME')
r = tbl_from.scan()
d = r['Items']
@ejdoh1
ejdoh1 / run.sh
Created January 30, 2020 05:47
AWS SSM Agent installation in Hybrid Environment
# Assuming server is Ubuntu 18
# First get an SSM agent activate code
# - Login to the AWS web console and browse to the AWS Systems Manager service (SSM).
# - Under Instances & Nodes, select Hybrid Activations
# - Select 'Create activation', fill-out the form and get an activation code
# Login to your server via SSH and run the following commans, entering the code, id and region values
sudo snap install amazon-ssm-agent --classic
sudo systemctl stop snap.amazon-ssm-agent.amazon-ssm-agent.service
sudo /snap/amazon-ssm-agent/current/amazon-ssm-agent -register -code "activation-code" -id "activation-id" -region "region"
@ejdoh1
ejdoh1 / run.sh
Last active December 11, 2023 21:43
AWS SSM Agent Raspberry Pi Installation
# AWS SSM Agent RPi Installation
# First get an SSM agent activate code
# - Login to the AWS web console and browse to the AWS Systems Manager service (SSM).
# - Under Instances & Nodes, select Hybrid Activations
# - Select 'Create activation', fill-out the form and get an activation code
# Login to your server via SSH and run the following commans, entering the code, id and region values
mkdir /tmp/ssm
sudo curl https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/debian_arm/amazon-ssm-agent.deb -o /tmp/ssm/amazon-ssm-agent.deb
@ejdoh1
ejdoh1 / cam
Last active March 16, 2020 01:32
ITS ANS.1 Object Prototypes
('SEQUENCE', {
header: ('SEQUENCE', {
protocolVersion: 'INTEGER',
messageID: 'INTEGER',
stationID: 'INTEGER'
}),
cam: ('SEQUENCE', {
generationDeltaTime: 'INTEGER',
camParameters: ('SEQUENCE', {
basicContainer: ('SEQUENCE', {
@ejdoh1
ejdoh1 / get_mac.sh
Created July 27, 2020 05:17
Get raspberry pi MAC address
ifconfig eth0 | grep ether | tr -s ' ' | cut -f3 -d' '
@ejdoh1
ejdoh1 / notes.md
Last active July 28, 2020 14:14
Azure Windows GPU VM with Euro Truck Simulator (ETS2)

Azure VM Specs

  • OS: Windows (Windows Server 2019 Datacenter)
  • Size: Standard NV6_Promo (6 vcpus, 56 GiB memory)

Steps

@ejdoh1
ejdoh1 / lyrics1.txt
Created August 5, 2020 12:37
BeyoncAI
But I'm not the one to judge, I'm not even the one to judge
This all started when you looked at me
Baby
I wanted more than just a man
I needed a friend
You are my best friend (yeah)
I really like you (yeah)
And I really like you (yeah)
But baby I'm not a big girl
I'm not a chick, I'm not even close to chick