Skip to content

Instantly share code, notes, and snippets.

@martin-fv
martin-fv / PostList.stories.tsx
Last active December 20, 2023 09:15
Storybook mocking and Supertest with tRPC v10
import { Meta } from "@storybook/react/types-6-0";
import { PostList } from "../PostList";
import { getTRPCMock } from "../getTrpcMock";
export default {
title: "Components/PostList",
component: PostList,
} as Meta;
export const PostListPage = () => {
@etam
etam / git-crypt-rm-gpg-user.sh
Last active July 21, 2023 20:03 — forked from Falkor/git-crypt-rm-gpg-user.sh
Git-crypt remove user.
#!/usr/bin/env bash
#
# Script to remove GPG user (recipient) with git-crypt
#
# It will re-initialize git-crypt for the repository and re-add all keys except
# the one requested for removal.
#
# Note: You still need to change all your secrets to fully protect yourself.
# Removing a user will prevent them from reading future changes but they will
# still have a copy of the data up to the point of their removal.
import { useField } from 'formik'
import { useTranslation } from 'next-i18next'
import { FormControl, FormControlLabel, FormHelperText, Radio, RadioGroup } from '@mui/material'
import CircleOutlinedIcon from '@mui/icons-material/CircleOutlined'
import CheckCircleIcon from '@mui/icons-material/CheckCircle'
import { TranslatableField, translateError } from 'common/form/validation'
import { createStyles, makeStyles } from '@mui/styles'
const useStyles = makeStyles(() =>
createStyles({
@the-spyke
the-spyke / pipewire.md
Last active March 9, 2024 21:23
Enable PipeWire on Ubuntu 22.04

Enable PipeWire on Ubuntu 22.04

This guide is only for original Ubuntu out-of-the-box packages. If you have added a custom PPA like pipewire-debian, you might get into conflicts.

Ubuntu 22.04 has PipeWire partially installed and enabled as it's used by browsers (WebRTC) for recoding the screeen under Wayland. We can enable remaining parts and use PipeWire for audio and Bluetooth instead of PulseAudio.

Starting from WirePlumber version 0.4.8 automatic Bluetooth profile switching (e.g. switching from A2DP to HSP/HFP when an application needs microphone access) is supported. Jammy (22.04) repos provide exactly version 0.4.8. So, we're good.

Based on Debian Wiki, but simplified for Ubuntu 22.04.

-- This script was generated by the Schema Diff utility in pgAdmin 4
-- For the circular dependencies, the order in which Schema Diff writes the objects is not very sophisticated
-- and may require manual changes to the script to ensure changes are applied in the correct order.
-- Please report an issue for any failure with the reproduction steps.
BEGIN;
-- Cast: money -> bigint
@RDeluxe
RDeluxe / sentry.ts
Created January 19, 2021 10:42
Sentry Interceptor for Nestjs
///// SERVICE
import { Injectable } from '@nestjs/common';
import * as Sentry from '@sentry/node';
import config from '../../config';
import { SentryEntry } from './sentry.interceptor';
@Injectable()
export class SentryService {
private isInit = false;
@kachar
kachar / Link-Next13.tsx
Last active January 21, 2024 11:44
Next.js Link + Material UI Link/Button components bundled with forwardRef

CockroachDB and Docker Compose

This is the first in a series of tutorials on CockroachDB and Docker Compose

  • Information on CockroachDB can be found here.
  • Information on Docker Compose can be found here
  1. Install Docker Desktop

Because we already have an official CockroachDB docker image, we will use that in our docker-compose.yml file. We recommend you use one of the current tags instead of latest.

@iwan-uschka
iwan-uschka / Auth.js
Created October 16, 2019 07:55
Keycloak vs. React
import Keycloak from 'keycloak-js';
class Auth {
constructor() {
this.authenticated = false;
this.keycloak = Keycloak('/keycloak.json');
}
login(callback) {
this.keycloak
@OnnoGabriel
OnnoGabriel / create_certificates.sh
Last active October 31, 2020 20:17
Create self-signed CA certificates and certificates for local domains
#!/bin/bash
# Creates self-signed CA certificates and certificates for local domains.
#
# Prompts for a local domain name (e.g. my-app.localhost) and creates all
# necessary certificates.
#
# Next steps:
# Copy the certificates (e.g. my-app.localhost.crt and my-app.localhost.key) to
# your service (Nginx, Apache, ...) and configure it.