This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
if [ ! "$1" ] | |
then | |
echo "Expected a hostname of the instance as a parameter." | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Host i-* mi-* aws-* | |
IdentityFile ~/.ssh/id_rsa | |
ProxyCommand ~/.ssh/initiate-ssm-connection.sh %h %p |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Host i-* mi-* | |
ProxyCommand bash -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# Installing required packages for the Android SDK | |
# and the emulator. | |
sudo apt update -y && \ | |
DEBIAN_FRONTEND=noninteractive sudo apt install -y --no-install-recommends \ | |
socat \ | |
iproute2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# Environment variables defining the specific Android SDK | |
# to install. | |
export API_LEVEL="${API_LEVEL:-33}" | |
export IMG_TYPE="${IMG_TYPE:-google_apis}" | |
export ARCHITECTURE=x86_64 | |
export ANDROID_SDK_ROOT="${ANDROID_SDK_ROOT:-/opt/android}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# Installing required packages for the Android SDK | |
# and the emulator. | |
sudo apt update -y && \ | |
DEBIAN_FRONTEND=noninteractive sudo apt install -y --no-install-recommends \ | |
unzip \ | |
wget \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mosquitto_pub \ | |
--cert path/to/certificate.pem.crt \ | |
--key path/to/private/key.pem.key \ | |
--cafile path/to/AmazonRootCA1.pem \ | |
--host <id>-ats.iot.<region>.amazonaws.com \ | |
--port 443 \ | |
--tls-alpn "x-amzn-mqtt-ca" \ | |
--topic "device/telemetry" \ | |
--message "foo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A fast solution to the problem of letter combinations of a phone number. | |
* | |
* Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. | |
* Return the answer in any order. A mapping of digits to letters (just like on the telephone buttons) is given. | |
* Note that 1 does not map to any letters. | |
* | |
* Example 1: | |
* Input: digits = "23" | |
* Output: ["ad","ae","af","bd","be","bf","cd","ce","cf"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
/** | |
* A cross-platform and compiler independant implementation | |
* of offsetof. | |
*/ | |
#define my_offsetof(ptr, member_name) \ | |
(((size_t) (&(ptr)->member_name)) - ((size_t) ptr)) | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define my_offsetof(ptr, member_name) \ | |
(((size_t) (&(ptr)->member_name)) - ((size_t) ptr)) |
NewerOlder