Skip to content

Instantly share code, notes, and snippets.

View shrugs's full-sized avatar
💭
welcome to my aim profile!! ~~~~ xoxoxo !linkin^park^lover! xoxoxo ~~~

shrugs shrugs

💭
welcome to my aim profile!! ~~~~ xoxoxo !linkin^park^lover! xoxoxo ~~~
  • NYC, TYO
View GitHub Profile
@shrugs
shrugs / amulet.ts
Created February 24, 2021 04:30
amulet verification code
import { utils } from 'ethers'
export interface Amulet {
value: string;
hash: string;
count: number;
}
const getAmuletCount = (hash: string): number => {
const matches = hash.match(/(8)\1*/g);
@shrugs
shrugs / README.md
Created October 21, 2019 09:26
apollo + next

these are the relevant files from my next + apollo + prisma setup. the prisma bit isn't relevant and can just be removed from the context. likewise my resolvers + typedefs setup is hyper specific and there are infinitely many way to do this (lol javascript)

the only relevant bit that might be missing is the handler path that has to match your next.js route

import AWS = require("aws-sdk");
import got = require("got");
import {
Context,
DynamoDBStreamEvent,
StreamRecord,
AttributeValue,
} from "aws-lambda";
import { uniq, keyBy } from "lodash";
import { Context } from "aws-lambda";
import AWS = require("aws-sdk");
import { orderBy, uniq } from "lodash";
import dynamodb from "./dynamodb";
import { kLiveChannelsTable } from "./environment";
import { LiveChannelInfo, LiveChannelRecord } from "./types";
import { InternalError } from "./errors";
import { getKnownChannelInfos } from "./channelInfo";
import AWS = require("aws-sdk");
import { DateTime } from "luxon";
const dynamodb = new AWS.DynamoDB();
const kLiveChannelsTable = "live-channels";
const kLiveChannelConstantPartitionKey = "constant";
const kLiveChannelTTL = { minutes: 15 };
const fetchLiveChannels = async (
cursor?: string,
@shrugs
shrugs / deploy.js
Last active August 31, 2018 01:58
820 deploy code
const pify = require("pify");
const peth = pify(web3.eth);
const Transaction = require("eth-lib/lib/transaction");
const Bytes = require("eth-lib/lib/bytes");
const RLP = require("eth-lib/lib/rlp");
const deterministicallyDeploy = async (
TruffleContractInstance,
args = [],
pragma solidity ^0.4.24;
library Flags {
function makeFlagSet(bytes8[] _flags)
internal
pure
returns (bytes8)
{
pragma solidity ^0.4.24;
contract Greeter {
string greeting;
function greet() public view returns (string) {
return greeting;
}
2018-04-17 20:44:46 UTC Syncing #5457959 ccd1…5fec 0 blk/s 0 tx/s 0 Mgas/s 969+ 1 Qed #5458775 26/50 peers 21 MiB chain 11 MiB db 37 MiB queue 167 KiB sync RPC: 0 conn, 0 req/s, 0 µs
2018-04-17 20:44:56 UTC Syncing #5457959 ccd1…5fec 0 blk/s 0 tx/s 0 Mgas/s 971+ 1 Qed #5458776 26/50 peers 21 MiB chain 11 MiB db 37 MiB queue 167 KiB sync RPC: 0 conn, 0 req/s, 0 µs
2018-04-17 20:45:05 UTC Syncing #5457959 ccd1…5fec 0 blk/s 0 tx/s 0 Mgas/s 971+ 1 Qed #5458776 26/50 peers 21 MiB chain 11 MiB db 37 MiB queue 167 KiB sync RPC: 0 conn, 0 req/s, 0 µs
2018-04-17 20:45:16 UTC Syncing #5457959 ccd1…5fec 0 blk/s 0 tx/s 0 Mgas/s 971+ 1 Qed #5458776 26/50 peers 21 MiB chain 11 MiB db 37 MiB queue 167 KiB sync RPC: 0 conn, 0 req/s, 0 µs
2018-04-17 20:45:25 UTC Syncing #5457959 ccd1…5fec 0 blk/s 0 tx/s 0 Mgas/s 971+ 1 Qed #5458776 26/50 peers 21 MiB chain 11 MiB db 37 MiB queue 167 KiB sync RPC: 0 conn,
Verifying my Blockstack ID is secured with the address 17hsRknAfqB88g9EBPbkUaGvUV4v3g6dxq https://explorer.blockstack.org/address/17hsRknAfqB88g9EBPbkUaGvUV4v3g6dxq