Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mimoo
mimoo / RDRAND.c
Created July 13, 2017 14:57
mirror from @DefuseSec analysis of RDRAND's code
// 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.
/*
@thepassle
thepassle / swsr.js
Last active April 23, 2024 08:17
swsr.js
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);
@gmolveau
gmolveau / how_to_reverseproxy_proxypass_nginx_letsencrypt.md
Last active April 23, 2024 08:14
How to use nginx as a reverse-proxy with letsencrypt

How to use nginx as a reverse-proxy with letsencrypt

Your infrastructure

generated via plantuml

Imgur

Requirements

@fenying
fenying / auto-init-ssh-agent.sh
Last active April 23, 2024 08:13
Auto-start ssh-agent when BASH starts, and reuse for all bash instance.
# 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)
@sorny
sorny / x11_forwarding_macos_docker.md
Last active April 23, 2024 08:11
X11 forwarding with macOS and Docker

X11 forwarding on macOS and docker

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)
@rveitch
rveitch / sass-7-1-pattern.scss
Last active April 23, 2024 08:10
Sass 7-1 Pattern
sass/
|
|– base/
| |– _reset.scss # Reset/normalize
| |– _typography.scss # Typography rules
| ... # Etc…
|
|– components/
| |– _buttons.scss # Buttons
| |– _carousel.scss # Carousel
@arkatsy
arkatsy / zustand-internals.jsx
Last active April 23, 2024 08:10
How zustand works internally
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) {
@FloppyGit
FloppyGit / tradfri_e1743_switch_to_light.yaml
Created December 6, 2023 09:57
Home Assistant Automation Blueprint: Tradfri E1743 Switch to Light via zigbee2mqtt
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:
#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";
@orimanabu
orimanabu / install_podman_on_amazon_linux_2023.sh
Last active April 23, 2024 08:08
Install Podman on Amazon Linux 2023
#!/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