Skip to content

Instantly share code, notes, and snippets.

@jebarjonet
jebarjonet / codeToFlag.js
Last active February 6, 2023 15:57
Transforms a country code (ISO 3166-1 alpha-2) into corresponding flag emoji
import { toUpper } from 'lodash'
export const codeToFlag = (code: string): string =>
String.fromCodePoint(
...toUpper(code)
.split('')
.map(c => 127397 + c.charCodeAt(0)),
)
// codeToFlag('fr') => 🇫🇷
@dglaude
dglaude / 1st_readme.txt
Last active April 28, 2024 12:40
Home Assistant Rainbow Loop with Ikea Tradfri RGB light
Please find below the various piece of code that together control my RGB light to loop in Rainbow.
Every two seconds, it change from one colour to another based on the value of the second.
So it compute 30 differents RGB value in a "circle", all with the same Saturation and Brightness both forced to 1.0
The transition from one colour to another is done in one seconds.
The name of my Tradfri RGB light bulb is "light.couleur"
A link to my video on Twitter:
https://twitter.com/DavidGlaude/status/1059596285991366657
@lizthegrey
lizthegrey / attributes.rb
Last active February 24, 2024 14:11
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'

Synergy between Linux and Mac Os X

sharing a mouse and keyboard between two computers

A quick writeup for a working setup (Linux is Server, Mac is Client)

synergy.conf:

section: screens
    linux:
 mac:
@debsahu
debsahu / esphome_dotmatrix_display.yaml
Last active November 9, 2023 17:04
ESPHome config for connected ESP8266 to MAX7219 Dot-Matrix Display to show useful information from HomeAssistant
esphome:
name: veneer_display
platform: ESP8266
board: d1_mini
wifi:
networks:
- ssid: !secret esphome_wifi_ssid1
password: !secret esphome_wifi_pass1
# - ssid: !secret esphome_wifi_ssid2