Skip to content

Instantly share code, notes, and snippets.

View andrioid's full-sized avatar

Andri Óskarsson andrioid

View GitHub Profile
@adtac
adtac / Dockerfile
Last active May 28, 2024 01:38
#!/usr/bin/env docker run
#!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')"
# syntax = docker/dockerfile:1.4.0
FROM node:20
WORKDIR /root
RUN npm install sqlite3
@mitchellh
mitchellh / merge_vs_rebase_vs_squash.md
Last active July 4, 2024 13:50
Merge vs. Rebase vs. Squash

I get asked pretty regularly what my opinion is on merge commits vs rebasing vs squashing. I've typed up this response so many times that I've decided to just put it in a gist so I can reference it whenever it comes up again.

I use merge, squash, rebase all situationally. I believe they all have their merits but their usage depends on the context. I think anyone who says any particular strategy is the right answer 100% of the time is wrong, but I think there is considerable acceptable leeway in when you use each. What follows is my personal and professional opinion:

@BitPhinix
BitPhinix / binding.tsx
Last active May 30, 2024 20:16
yjs react binding
import React, { useMemo, useSyncExternalStore } from "react";
import {
type SharedArray,
type SharedDoc,
type SharedMap,
type SharedType,
type ToJson,
type ToJsonDeep,
} from "./types.ts";
@MortenVinding
MortenVinding / MEATER.yaml
Created April 15, 2023 23:46
ESPHome yaml config to integrate a MEATER cooking thermometer in to Home Assistant
esphome:
name: meater
friendly_name: MEATER
esp32:
board: esp32dev
#board: esp32-c3-devkitm-1
framework:
#type: esp-idf
type: arduino
@MarksCode
MarksCode / use-prompt.ts
Last active July 16, 2024 14:18
return `usePrompt` capabilities from react-router
/**
* Prompts a user when they exit the page
*/
import { useCallback, useContext, useEffect } from 'react';
import { UNSAFE_NavigationContext as NavigationContext } from 'react-router-dom';
function useConfirmExit(confirmExit: () => boolean, when = true) {
const { navigator } = useContext(NavigationContext);
@bzerangue
bzerangue / home-assistant-x86-install.md
Last active July 4, 2024 16:44
Using Live Image of ZorinOS/Ubuntu/Linux Mint to Create Home Assistant OS boot drive - for x86 machines

Installing the official Home Assistant OS on an old x86 PC.

This is not a support document. Not responsible for whomever might use this. This put down for my personal use and if anyone else wants to use it they can, but this process will remove any data from the target device they are installing on.

REQUIREMENTS:

  • Intel or AMD x86 PC, monitor, keyboard, internet connection via ethernet.
  • Bootable USB thumb drive of the latest dekstop version of ZorinOS, Ubuntu, or Linux Mint
  1. Boot your machine with the bootable Zorin OS and select Try Zorin OS (you do NOT want to install it)
@kepano
kepano / obsidian-web-clipper.js
Last active July 16, 2024 14:14
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
@ChronSyn
ChronSyn / babel.config.js
Last active May 20, 2024 04:01
Expo - Alias path example
module.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: [
["@babel/plugin-transform-flow-strip-types"],
["@babel/plugin-proposal-decorators", { "legacy": true }],
["@babel/plugin-proposal-class-properties", { "loose": true }],
["module-resolver", {
"alias": {
@niro1987
niro1987 / binary_sensor_light_toggle.yaml
Last active April 13, 2024 09:07
Home Assistant - Blueprint - Toggle a light with a binary sensor
---
# This automation takes a binary_sensor to toggle a light.
blueprint:
source_url: https://github.com/niro1987/homeassistant-config/blob/main/blueprints/automation/niro1987/binary_sensor_toggle_light.yaml
name: Toggle a light with a binary sensor
description: >-
This automation takes a binary_sensor to toggle a light.