Skip to content

Instantly share code, notes, and snippets.

View justingreenberg's full-sized avatar

justin justingreenberg

View GitHub Profile
@thelastlin
thelastlin / libsk-libfido2_BUILD_FROM_OPENSSH.md
Last active April 23, 2024 02:59
Build libsk-libfido2.so from OpenSSH-portable

Tested on macOS Sonoma Developer beta 2 (23A5276g)

Build libsk-libfido2.so

Prerequisite

  1. Download openssh-portable source code, install libcrypto, libfido2;
  2. Configure openssh-portable build system by ./configure # [options].

Apply patch

@kettanaito
kettanaito / README.md
Last active July 21, 2024 23:17
Chromium on Vercel (serveless)

Chromium on Vercel (serverless)

This is an up-to-date guide on running Chromium in Vercel serverless functions in 2022. What you will read below is the result of two days of research, debugging, 100+ failed deployments, and a little bit of stress.

Getting started

Step 1: Install dependencies

Use chrome-aws-lambda that comes with Chromium pre-configured to run in serverless, and puppeteer-core due to the smaller size of Chromium distributive.

@trayvox
trayvox / L0_2.sol
Last active February 20, 2023 03:03
Example showing how Layer Zero can rug if team is malicious
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.10;
import {ERC20, SafeTransferLib} from "solmate/utils/SafeTransferLib.sol";
import {DSTestPlus} from "solmate/test/utils/DSTestPlus.sol";
struct Packet {
uint16 srcChainId;
uint16 dstChainId;
@trayvox
trayvox / L0.sol
Last active April 1, 2024 19:09
Example to show how LayerZero can rug all LP's if unverified contracts are malicious
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.10;
import {ERC20, SafeTransferLib} from "solmate/utils/SafeTransferLib.sol";
import {DSTestPlus} from "solmate/test/utils/DSTestPlus.sol";
struct Packet {
uint16 srcChainId;
uint16 dstChainId;
@z0r0z
z0r0z / NFT.sol
Last active February 1, 2022 14:36
Based NFT implementation.
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
/// @notice Based NFT implementation.
abstract contract NFT {
/*///////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
@andrelandgraf
andrelandgraf / createSitemap.ts
Last active January 29, 2024 08:36
sitemap.xml generator for remix.run
import childProcess from 'child_process';
import fs from 'fs';
import dotenv from 'dotenv';
import prettier from 'prettier';
const rootDir = process.cwd();
dotenv.config({
path: `${rootDir}/.env.production`,
});
export default async function handleRequest(
request: Request,
responseStatusCode: number,
responseHeaders: Headers,
remixContext: EntryContext
) {
const url = new URL(request.url);
if (url.pathname.startsWith("/social-image")) {
registerFont("assets/fonts/Inter-Regular.otf", {
family: "Inter",
@unframework
unframework / XtermCanvas.tsx
Last active February 22, 2024 21:14
Snapshot of a Xterm.js + Ink component in React and cross-compilation settings to bundle Ink for the browser environment
import React, { useEffect, useRef } from 'react';
import ReactDOM from 'react-dom';
import { EventEmitter } from 'events';
import { Terminal } from 'xterm';
import { render } from 'ink';
/// <reference types="node" />
import 'xterm/css/xterm.css';
// this spins up Xterm.js, initializes Ink inside it and sets up
@nautilytics
nautilytics / handler.js
Last active November 15, 2020 17:48
A Node.js serverless implementation of appending an email to a Google Sheet via AWS API Gateway and AWS Lambda
'use strict';
const { GoogleSpreadsheet } = require('google-spreadsheet');
const middy = require('middy');
const { cors } = require('middy/middlewares');
const { to } = require('await-to-js');
const moment = require('moment');
const data = require('./primarycast-sheets.json');
////////////////////////////////////////////////////////////////////////////////
// Create a directory called "pages" next to
// this file, put markdown files in there, and
// then run:
//
// ```
// $ node build.mjs
// ```
//
// Then deploy the "build" directory somewhere.