Skip to content

Instantly share code, notes, and snippets.

View midN's full-sized avatar
🚔
SREing

Andres Ivanov midN

🚔
SREing
View GitHub Profile
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()
...
func Home() {
keyPress(4, 15)
}
func CycleInput() {
keyPress(7, 1)
}
func keyPress(codeset int, code int) {
rgroup:
Type: AWS::Route53::RecordSetGroup
Properties:
HostedZoneId: !Ref zone
RecordSets:
- Name: yourapp
Type: CNAME
SetIdentifier: ECS
Weight: '9'
ResourceRecords:
@midN
midN / medium2_cname.yaml
Last active December 30, 2018 02:58
cname.yaml
cname:
Type: AWS::Route53::RecordSet
Properties:
Name: yourapp
Type: "CNAME"
HostedZoneId: !Ref zone
ResourceRecords:
- !Ref lb
apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
selector:
app: nginx
ports:
- protocol: TCP
port: 80
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
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 December 30, 2018 02:57
medium_eni_script
#!/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)
@midN
midN / medium1_eni.yaml
Last active December 30, 2018 02:57
medium_eni
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:
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