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
// This is a quick analysis of Linux's use of RDRAND. All double-slash (//) | |
// style comments are my own, all slash-star (/*) style comments are from the | |
// original code. This was written by Taylor Hornby (@DefuseSec). | |
// This is part of the drivers/char/random.c file. | |
// I have re-ordered the procedures for clarity. Everything inside them (except | |
// comments) is exactly as you will find it in linux-3.11.tar.xz | |
// This comment says it 'does not use' the hardware RNG. It actually does. | |
/* |
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 { defineConfig } from 'astro/config'; | |
import netlify from '@astrojs/netlify'; | |
import path from 'path'; | |
import fs from 'fs'; | |
import { injectManifest } from 'workbox-build'; | |
import { build } from "esbuild"; | |
import { createRequire } from 'module'; | |
const require = createRequire(import.meta.url); |
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 |
NewerOlder