Skip to content

Instantly share code, notes, and snippets.

Node.JS

node -e "console.log(require('crypto').randomBytes(256).toString('base64'));"

OpenSSL

openssl rand 256 | base64
Thread 1 "steam" received signal SIGINT, Interrupt.
0xf7fd0ab9 in __kernel_vsyscall ()
(gdb) backtrace
#0 0xf7fd0ab9 in __kernel_vsyscall ()
#1 0xf7ab1b83 in poll () from /usr/lib32/libc.so.6
#2 0xefbd278e in ?? () from /home/nk/.local/share/Steam/ubuntu12_32/vgui2_s.so
#3 0xefbe225d in ?? () from /home/nk/.local/share/Steam/ubuntu12_32/vgui2_s.so
#4 0xf2f5dbb6 in ?? () from /home/nk/.local/share/Steam/ubuntu12_32/steamui.so
#5 0xf2f5fa2e in ?? () from /home/nk/.local/share/Steam/ubuntu12_32/steamui.so
#6 0xf2f61b63 in ?? () from /home/nk/.local/share/Steam/ubuntu12_32/steamui.so
Computer Information:
Manufacturer: Unknown
Model: Unknown
Form Factor: Desktop
No Touch Input Detected
Processor Information:
CPU Vendor: GenuineIntel
CPU Brand: Intel(R) Core(TM) i5-4690K CPU @ 3.50GHz
CPU Family: 0x6
@n1ghtdev
n1ghtdev / form.tsx
Last active February 15, 2020 23:17
TSX render prop generic
interface Props<T> {
values: T;
children: (values: T) => React.ReactNode; // or JSX.Element
}
const Form = <T extends {}>({ values, children }: Props<T>) => children(values);
const App = () => (
<Form values={{ a: "" }}>{values => <input value={values.a} />}</Form>
);
import React, { useState } from "react";
import { Segment, Form, Input, Button } from "semantic-ui-react";
import { useContactsContext } from "../context/ContactContext";
export default function ContactForm() {
const name = useFormInput("");
const email = useFormInput("");
// Consume the context store to access the `addContact` action
const { addContact } = useContactsContext();
const importAll = (r) => {
if (r) {
const images = r.keys().reduce((obj, item) =>
({ ...obj, [item.replace('./', '')]: r(item) }), {});
return images;
}
return null;
};
const req = importAll(