Skip to content

Instantly share code, notes, and snippets.

View tou55aint's full-sized avatar

Derek Martin tou55aint

View GitHub Profile
@tou55aint
tou55aint / leetcode-questions-to-json.mjs
Created September 26, 2021 04:34
Convert LeetCode ePub to JSON format
import cheerio from 'cheerio';
import fs from 'fs';
import { globby } from 'globby';
const main = async() => {
const paths = await globby(['EPUB/*', '!cake']);
let results = [];
paths.forEach((path) => {
const data = fs.readFileSync(path, { encoding: 'utf8', flag: 'r' });
@tou55aint
tou55aint / leetcode.json
Created September 26, 2021 04:37
LeetCode questions converted to JSON
This file has been truncated, but you can view the full file.
[{
"id": "1",
"title": "Two Sum",
"question": "Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.\nYou may assume that each input would have exactly one solution, and you may not use the same element twice.\nYou can return the answer in any order.",
"examples": [
"Input: nums = [2,7,11,15], target = 9",
"Output: [0,1]",
"Output: Because nums[0] + nums[1] == 9, we return [0, 1].",
"Input: nums = [3,2,4], target = 6",
"Output: [1,2]",
did:3:kjzl6cwe1jw148zwta9w8m7qm8xe20qhf7wi3z2ts57wh4cj38nkcuiu2nkddcg

Keybase proof

I hereby claim:

  • I am derekmartinjs on github.
  • I am derekmartin (https://keybase.io/derekmartin) on keybase.
  • I have a public key ASAqyQ9mzE6g2mIyZMcnnhCu5gpXWDwJrixPXdbstf3PIQo

To claim this, I am signing this object:

// SPDX-License-Identifier: MIT
// contracts/FundingDAO.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
contract FundingDAO is ReentrancyGuard, AccessControl {
bytes32 public constant MEMBER = keccak256("MEMBER");
bytes32 public constant STAKEHOLDER = keccak256("STAKEHOLDER");
@tou55aint
tou55aint / mac.sh
Created February 18, 2022 19:27
mac os script
#!/usr/bin/env bash
# ~/.macos — https://mths.be/macos
defaults write NSGlobalDomain AppleLanguages -array "en" "us"
defaults write NSGlobalDomain AppleLocale -string "en_US@currency=USD"
defaults write NSGlobalDomain AppleMeasurementUnits -string "Inches"
defaults write NSGlobalDomain AppleMetricUnits -bool false
# Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons
const { Configuration, OpenAIApi } = require("openai");
const configuration = new Configuration({
apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);
const response = await openai.createCompletion("text-davinci-001", {
prompt: "Product description: A home milkshake maker\nSeed words: fast, healthy, compact.\nProduct names: HomeShaker, Fit Shaker, QuickShake, Shake Maker\n\nProduct description: A pair of shoes that can fit any foot size.\nSeed words: adaptable, fit, omni-fit.",
temperature: 0.8,
import { createMachine, send } from "xstate";
createMachine(
{
id: "Page transition",
type: "parallel",
states: {
"current page": {
initial: "visible",
states: {
{
"pageProps": {
"_nextI18Next": {
"initialI18nStore": {
"en": {
"common": {
"meta": {
"title": "",
"description": "",
"keywords": ""
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.