Skip to content

Instantly share code, notes, and snippets.

Avatar
🚔
SREing

Andres Ivanov midN

🚔
SREing
View GitHub Profile
View medium3_youtube.go
func OpenAndPlay() {
// Last menu could be something else, first call to Home doesn't open SmartCast, it just turns on TV
key_command.Home()
// It takes about 15s to open SmartCast menu with animation loading
key_command.Home()
time.Sleep(15 * time.Second)
// Just incase Vizio menu was frozen, go left 10x times :shrug:
key_command.Left()
key_command.Left()
View medium3_vizio.go
...
func Home() {
keyPress(4, 15)
}
func CycleInput() {
keyPress(7, 1)
}
func keyPress(codeset int, code int) {
View medium2_rgroup.yaml
rgroup:
Type: AWS::Route53::RecordSetGroup
Properties:
HostedZoneId: !Ref zone
RecordSets:
- Name: yourapp
Type: CNAME
SetIdentifier: ECS
Weight: '9'
ResourceRecords:
View medium2_cname.yaml
cname:
Type: AWS::Route53::RecordSet
Properties:
Name: yourapp
Type: "CNAME"
HostedZoneId: !Ref zone
ResourceRecords:
- !Ref lb
View medium2_k8s_eks.yaml
apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
selector:
app: nginx
ports:
- protocol: TCP
port: 80
View medium2_eks.yaml
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
vpcId:
Type: AWS::EC2::VPC::Id
subnet:
Type: AWS::EC2::Subnet::Id
zone:
Type: AWS::Route53::HostedZone::Id
cluster:
Type: String
View medium2_ecs.yaml
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
vpcId:
Type: AWS::EC2::VPC::Id
subnet:
Type: AWS::EC2::Subnet::Id
zone:
Type: AWS::Route53::HostedZone::Id
Resources:
lb:
@midN
midN / medium1_eni.sh
Last active Dec 30, 2018
medium_eni_script
View medium1_eni.sh
#!/bin/bash
instance_id=$(curl -s http://169.254.169.254/latest/meta-data/instance-id)
if ! ifconfig | grep $2 > /dev/null
then
aId=$(aws ec2 describe-network-interfaces --network-interface-ids $1 --query 'NetworkInterfaces[].Attachment.AttachmentId' --output text)
if [ "$aId" != "" ]; then aws ec2 detach-network-interface --attachment-id $aId; fi
aws ec2 wait network-interface-available --network-interface-ids $1
aws ec2 attach-network-interface --instance-id ${instance_id} --device-index 1 --network-interface-id $1
while [ ! -f "/sys/class/net/eth1/address" ];do echo ENI not available, waiting; sleep 2;done
hwaddr=$(cat /sys/class/net/eth1/address)
View medium1_eni.yaml
Eni:
Type: AWS::EC2::NetworkInterface
Properties:
SourceDestCheck: false
GroupSet: your_sg
SubnetId: your_subnet
PrivateIpAddress: 172.16.13.37
Eip:
Type: AWS::EC2::EIP
Properties:
View medium1_ssm.yaml
VPN:
Type: AWS::SSM::Association
Properties:
AssociationName: "vpn_sync"
Name: 'AWS-RunShellScript'
ScheduleExpression: "cron(0 0 0/1 1/1 * ? *)"
Parameters:
commands:
- !Sub |
#!/bin/bash