Skip to content

Instantly share code, notes, and snippets.

@drnic
drnic / Hello.tsx
Created June 15, 2023 23:37
In Rails apps using StimulusJS, load React components found at app/javascript/react/*/index.tsx, and make them available via Ruby helper react(name)
import React from "react";
const Hello = ({ name }: { name: string }) => <span>Hello {name}</span>;
Hello.defaultProps = { name: "World" }
export default Hello;
@joelthompson
joelthompson / README.md
Last active May 21, 2024 17:19
Vault Auth
@ohmantics
ohmantics / hb-setup.sh
Last active May 21, 2024 17:17
Homebridge in an iocage jail
DATASET=/zroot/apps
# Create the jail
iocage create -n "homebridge" -r 13.1-RELEASE dhcp=1 bpf=1 vnet=1 allow_raw_sockets="1" boot="on"
# switch to Latest
iocage exec homebridge "mkdir -p /usr/local/etc/pkg/repos"
iocage exec homebridge "echo -e 'FreeBSD: { url: \"pkg+http://pkg.FreeBSD.org/\${ABI}/latest\" }' > /usr/local/etc/pkg/repos/FreeBSD.conf"
# Install Homebridge and dependencies
@Jonalogy
Jonalogy / handling_multiple_github_accounts.md
Last active May 21, 2024 17:16
Handling Multiple Github Accounts on MacOS

Handling Multiple Github Accounts on MacOS

The only way I've succeeded so far is to employ SSH.

Assuming you are new to this like me, first I'd like to share with you that your Mac has a SSH config file in a .ssh directory. The config file is where you draw relations of your SSH keys to each GitHub (or Bitbucket) account, and all your SSH keys generated are saved into .ssh directory by default. You can navigate to it by running cd ~/.ssh within your terminal, open the config file with any editor, and it should look something like this:

Host *
 AddKeysToAgent yes

> UseKeyChain yes

@FbN
FbN / vite.config.js
Last active May 21, 2024 17:16
vite.config.js node built-in polyfills
// yarn add --dev @esbuild-plugins/node-globals-polyfill
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill'
// yarn add --dev @esbuild-plugins/node-modules-polyfill
import { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfill'
// You don't need to add this to deps, it's included by @esbuild-plugins/node-modules-polyfill
import rollupNodePolyFill from 'rollup-plugin-node-polyfills'
export default {
resolve: {
alias: {
@realvjy
realvjy / ChoasLinesShader.metal
Last active May 21, 2024 17:14
Choas Lines - Metal Shader
// Lines
float hash( float n ) {
return fract(sin(n)*753.5453123);
}
// Slight modification of iq's noise function.
float noise(vector_float2 x )
{
vector_float2 p = floor(x);
vector_float2 f = fract(x);
@wallyhall
wallyhall / apache_airflow_sso_howto.md
Last active May 21, 2024 17:14
Apache Airflow Azure AAD SSO howto

The following instructions for enabling Azure SSO for Apache Airflow nearly take you all the way - but fall short a couple of details around the configuration of airflow itself:

https://objectpartners.com/2021/12/24/enterprise-auth-for-airflow-azure-ad

All the "Azure" instructions there can be safely followed - the resulting webserver_config.py (which can be injected into a dockerised Airflow in /opt/airflow/webserver_config.py) can be built from the following:

from __future__ import annotations

import os
@Seveen
Seveen / ease_helpers.odin
Created May 19, 2024 19:48
Easing helpers
// Helpers ===========================
AnimationInfo :: struct {
animation: proc(info: AnimationInfo),
value: ^f32,
goal: f32,
}
chain :: proc(
tween: ^ease.Flux_Tween($T),
@fnky
fnky / ANSI.md
Last active May 21, 2024 17:06
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27