Skip to content

Instantly share code, notes, and snippets.

View wingedrhino's full-sized avatar

Rhino wingedrhino

View GitHub Profile
@wingedrhino
wingedrhino / getLensCredentials.ts
Created March 24, 2023 11:35
Getting access token from the lens sdk
/**
* The official Lens SDK does not directly expose credentials to you.
* But we need it for letting the backend authenticate us via Lens.
* To help with that, this function is a hacky workaround.
* @returns The access token, or an empty string if not authenticated.
*/
async function getCredentials (lens: LensClient): Promise<string> {
const lensAuth = lens.authentication as Authentication
const getHeadersResp = await lensAuth.getRequestHeader()
if (getHeadersResp.isFailure()) {
@wingedrhino
wingedrhino / ps2_synaptics.c
Created May 15, 2020 00:52 — forked from buzztiaan/ps2_synaptics.c
Implementation of synaptics touchpad driver example NON-interrupt driven, just polling!
#define PS2_clockpin PE_2
#define PS2_datapin PE_3
byte read_CLOCK() {
return digitalRead(PS2_clockpin);
}
byte read_DATA() {
return digitalRead(PS2_datapin);
}
-- do this one-time
CREATE OR REPLACE FUNCTION test_add_json(inp jsonb) RETURNS jsonb AS
$$
DECLARE
response jsonb;
BEGIN
response := '{}'::jsonb;
SELECT into response jsonb_insert(response, '{sum}', ((inp->>'a')::int + (inp->>'b')::int)::text::jsonb);
RETURN response;
END;
@wingedrhino
wingedrhino / NewBusinessQuestionnaire.md
Last active December 22, 2018 17:28
A questionnaire to help completely describe a new business/product idea to a potential cofounder/investor for evaluation.

New Product / Business Idea Questionnaire

Why Does This Exist ?

You are extremely enthusiastic (and rightfully so) about a new product or business idea that you have. Or maybe someone approaching you is (but I'm going to assume that you're the one with the idea for simplicity). You want to bring a cofounder (or an investor) onboard. This can involve a lot of back and forth calls and/or emails that takes up a lot of time. To help paint a clear picture about your product/business idea, here is a questionnaire you can fill up and

What Makes a Good Architecture

  • Performance should linearly increase with added nodes and no extra effort. If the number of people required to maintain a system doubles with doubled capacity, you're doing it wrong.

  • Errors shouldn't cause growing data smell and should be quick to recover from.

  • The lesser locks there are in the system, the better it is.

  • Don't depend on something that wouldn't scale or keep up with the rest of the application.