generated via plantuml
Discover gists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add following code at the end of ~/.bashrc | |
# Check if ~/.pid_ssh_agent exists. | |
if [ -f ~/.pid_ssh_agent ]; then | |
source ~/.pid_ssh_agent | |
# Check process of ssh-agent still exists. | |
TEST=$(ssh-add -l) |
A quick guide on how to setup X11 forwarding on macOS when using docker containers requiring a DISPLAY. Works on both Intel and M1 macs!
This guide was tested on:
- macOS Catalina 10.15.4
- docker desktop 2.2.0.5 (43884) - stable release
- XQuartz 2.7.11 (xorg-server 1.18.4)
- Macbook Pro (Intel)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sass/ | |
| | |
|– base/ | |
| |– _reset.scss # Reset/normalize | |
| |– _typography.scss # Typography rules | |
| ... # Etc… | |
| | |
|– components/ | |
| |– _buttons.scss # Buttons | |
| |– _carousel.scss # Carousel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useSyncExternalStore } from "react"; | |
// For more on the useSyncExternalStore hook, see https://react.dev/reference/react/useSyncExternalStore | |
// The code is almost identical to the source code of zustand, without types and some features stripped out. | |
// Check the links to see the references in the source code. | |
// The links are referencing the v5 of the library. If you plan on reading the source code yourself v5 is the best way to start. | |
// The current v4 version contains lot of deprecated code and extra stuff that makes it hard to reason about if you're new to this. | |
// https://github.com/pmndrs/zustand/blob/fe47d3e6c6671dbfb9856fda52cb5a3a855d97a6/src/vanilla.ts#L57-L94 | |
function createStore(createState) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Tradfri E1743 Switch to Light via zigbee2mqtt | |
description: "Controls a light with a switch given by ENTITY. \n\nShort Button press will toggle light for both Buttons (helpfull in darkness) \n\n Mode set to restart is mandatory for stop after long press to work." | |
domain: automation | |
input: | |
source_switch_e1743_action: | |
name: Tradfri E1743 Switch | |
description: The switch-action which triggers this automation. | |
selector: | |
entity: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <cfgmgr32.h> | |
int main() | |
{ | |
DEVINST devParentInst = 0; | |
DEVINST devInst = 0; | |
CONFIGRET status = 0; | |
const DEVINSTID_W PhantomDevNode = (DEVINSTID_W)L"ROOT\\TOASTER\\0000"; | |
const DEVINSTID_W ToasterBasicID = (DEVINSTID_W)L"TOASTER\\BASIC_TOASTER"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# To build podman, you have enough resource on the instance. | |
# I tested this script on t2.xlarge. | |
topdir=${HOME}/work | |
mkdir -p ${topdir} | |
# Install prereq rpms | |
sudo dnf install -y git golang libseccomp-devel gpgme-devel autoconf automake libtool yajl yajl-devel libcap-devel systemd-devel cni-plugins iptables-nft rpm-build meson golang-github-cpuguy83-md2man.x86_64 |
Picking the right architecture = Picking the right battles + Managing trade-offs
- Clarify and agree on the scope of the system
- User cases (description of sequences of events that, taken together, lead to a system doing something useful)
- Who is going to use it?
- How are they going to use it?
Reasons:
- UNIX standard
- If the last line in a file doesn't end with a newline then addition of next line affects two lines instead of one. This also pollutes diff on multiple files, so reader may wonder what has changed in a line whereas no significant change has occured.
Multiple newlines at the file end are also redundant as well as spaces at the end of line.
NewerOlder