Skip to content

Instantly share code, notes, and snippets.

View bmpandrade's full-sized avatar
🐼

Bruno Andrade bmpandrade

🐼
View GitHub Profile
@bmpandrade
bmpandrade / adventofcode2022-day1-openai-typescript.ts
Created December 1, 2022 15:01
adventofcode2022-day1-openai-typescript.ts
/* Resolve https://adventofcode.com/2022/day/1 exercise using typescript */
/*
--- Day 1: Report Repair ---
After saving Christmas five years in a row, you've decided to take a vacation at a nice resort on a tropical island. Surely, Christmas will go on without you.
The tropical island has its own currency and is entirely cash-only. The gold coins used there have a little picture of a starfish; the locals just call them stars. None of the currency exchanges seem to have heard of them, but somehow, you'll need to find fifty of these coins by the time you arrive so you can pay the deposit on your room.
To save your vacation, you need to get all fifty stars by December 25th.
Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck!
Before you leave, the Elves in accounting just need you to fix your expense report (your puzzle input); apparently, something isn't quite
blueprint:
name: Timed Motion-activated Dimmable Light (Active & Idle brightness)
description: Turn on a light when motion is detected within a certain time contraint.
domain: automation
source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/motion_light.yaml
input:
motion_entity:
name: Motion Sensor
selector:
entity:
#!/bin/bash
cd /sys/kernel/config/usb_gadget/
mkdir -p pi4
cd pi4
echo 0x1d6b > idVendor # Linux Foundation
echo 0x0104 > idProduct # Multifunction Composite Gadget
echo 0x0100 > bcdDevice # v1.0.0
echo 0x0200 > bcdUSB # USB2
echo 0xEF > bDeviceClass
echo 0x02 > bDeviceSubClass
auto usb0
allow-hotplug usb0
iface usb0 inet static
address 10.55.0.1
netmask 255.255.255.248
interface=usb0
dhcp-range=10.55.0.2,10.55.0.6,255.255.255.248,1h
dhcp-option=3
leasefile-ro
BEGIN MESSAGE.
ESFaX9iIAEazpWs rsopLUr8n5fq97O T9H0FvhTO79SxDr OD3zAcbh3cg6dCm
bj1nvthLtlmdJrj 5Yo3jd4kLnWTCKq 6Xr2MZHgg707Vme XXwXTuf2mRsFXyc
WM95xLWsuOIdxzN ryAh7q5Qm40JT1Y EF3EHdn9f7QHx3A dmi3cAER82FzQfy
k7pTNrQIcSMo9rn JK2wTOKRMJB9VnG JH1Km7tiSkCT.
END MESSAGE.

Keybase proof

I hereby claim:

  • I am bmpandrade on github.
  • I am bmandrade (https://keybase.io/bmandrade) on keybase.
  • I have a public key ASC0cFj1VOSAfA7qbejWQv1LZzU5_7ig4aHK9OkA7Fi3cQo

To claim this, I am signing this object:

@bmpandrade
bmpandrade / update-linode-lb-ssl-cert.sh
Last active October 4, 2018 20:18
update linode ssl certs on nodebalancer with letsencrypt certs
#! /bin/bash
### ATTENTION : NOT READY FOR PRODUTION YET ###
### LINODE ACCEPTS BUT THEN BROWSERS SHOW ###
### SSL_ERROR_RX_RECORD_TOO_LONG ###
DOMAIN="example.com"
CERT_DIR="/opt/acme/certs/$DOMAIN"
TOKEN="XXXXXXXXXX"
NB_ID=XXXXX
@bmpandrade
bmpandrade / acme.md
Last active November 15, 2019 13:13

Using ACME script

Using ACME script to handle let's encrypt certs is a life savior. It automates the creation, verification on DigitalOcean and automatic renewals based on a cronjob.

Download & Install

cd /tmp/
git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh

Keybase proof

I hereby claim:

  • I am bmandrade on github.
  • I am bmandrade (https://keybase.io/bmandrade) on keybase.
  • I have a public key ASA8qCsEsKxbV2DKDYNX-ujg2AzsthNNHbwDi2uNm7GEugo

To claim this, I am signing this object: