Skip to content

Instantly share code, notes, and snippets.

View the-vampiire's full-sized avatar
💭
ive lost a shade of color in my life. rest in peace.

the-vampiire

💭
ive lost a shade of color in my life. rest in peace.
View GitHub Profile
@the-vampiire
the-vampiire / interface-ids.js
Last active May 11, 2022 14:59
ERC165 interface IDs (ERC721 etc)
const INTERFACE_IDS = {
ERC165: '0x01ffc9a7',
ERC721: '0x80ac58cd',
ERC721Enumerable: '0x780e9d63',
ERC721Metadata: '0x5b5e139f',
ERC1155: '0xd9b67a26',
ERC1155Receiver: '0x4e2312e0',
AccessControl: '0x7965db0b',
AccessControlEnumerable: '0x5a05180f',
Governor: '0xbf26d897',
@the-vampiire
the-vampiire / mongo-atlas-whitelist-entrypoint.md
Last active March 26, 2024 08:26
docker entrypoint to automatically whitelist mongo atlas IP

why

mongo atlas provides a reasonably priced access to a managed mongo DB. CSPs where containers are hosted charge too much for their managed mongo DB. they all suggest setting an insecure CIDR (0.0.0.0/0) to allow the container to access the cluster. this is obviously ridiculous.

this entrypoint script is surgical to maintain least privileged access. only the current hosted IP address of the service is whitelisted.

related searches, hope this shows up for you

  • "How to connect to mongodb atlas cluster to container app service EKS ECS cloudrun compute engine"
  • "mongodb atlas cluster access without using whitelist 0.0.0.0"
@the-vampiire
the-vampiire / .test.env
Last active February 2, 2022 19:54
algorand sandbox global jest setup consistent test accounts
# using algorand sandbox
# https://github.com/algorand/sandbox
ALGORAND_ALGOD_API_BASE_URL=http://localhost
ALGORAND_ALGOD_API_PORT=4001
ALGORAND_ALGOD_TOKEN=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ALGORAND_KMD_API_BASE_URL=http://localhost
ALGORAND_KMD_API_PORT=4002
ALGORAND_KMD_TOKEN=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@the-vampiire
the-vampiire / 1-dom-counter.js
Last active December 9, 2020 18:57
react basics (DOM, class-based, function with hooks)
// vanilla DOM approach: you manage state (externally) and updating the DOM manually
// state must be managed externally in a variable
const state = { count: 0 };
const counterDiv = document.createElement("div");
const counterSpan = document.createElement("span");
counterSpan.textContent = `The count is: ${state.count}`;
@the-vampiire
the-vampiire / table-foreign.stub
Created January 30, 2020 03:54
knex-stub-sample
/* eslint func-names:0 */
exports.up = function (knex) {
return knex.schema.createTable("", (table) => {
table.increments();
table
.integer("") // foreign_key_name
.unsigned()
.notNullable()
.references("") // table.primary_key_name
@the-vampiire
the-vampiire / create-element.md
Last active December 1, 2019 01:31
short tool for easily creating DOM elements and children (mini OG react :])

Create Element

A short (~50 lines of code) tool that you can use to easily create DOM elements and their children. Similar to the original React way of creating components :]

Simple Example

with config.children using just HTML template strings and a nested config object.

Initial HTML

@the-vampiire
the-vampiire / jquery-light.js
Created November 28, 2019 04:09
90% of JQuery
/**
* 90% of JQuery
* @param {String} cssSelectorString: any valid css selector syntax
* @returns for ID selectors: Element
* @returns for others: Element[] (NodeList)
*/
export const $ = cssSelectorString =>
/^#/.test(cssSelectorString)
? document.querySelector(cssSelectorString)
: document.querySelectorAll(cssSelectorString);
@the-vampiire
the-vampiire / gist:a3621c22de5daf2e804fa3942d37de97
Created October 11, 2019 15:07 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.


Updated Apr 5 2019:

because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.

some other notes:

@the-vampiire
the-vampiire / 00-https-single-instance.yaml
Created September 2, 2019 10:13
AWS EB elastic beanstalk single instance nodejs nginx SSL/HTTPS ebextensions config file
# REQUIREMENTS
# set the following configuration environment variables at: configuration -> software -> modify -> environment variables
# CERT_EMAIL: the email address used for registering the cert
# CERT_DOMAIN: the domain to create a cert for
# EB environment URL (listed at the top of the environment page) or a custom domain, custom domains must have a DNS CNAME record pointing to the EB environment URL
# !! MUST NOT have "http://" prefix or the trailing "/" at the end !!
# EXAMPLES
@the-vampiire
the-vampiire / apollo-directives.md
Created July 28, 2019 16:56
apollo-directives library proposal

apollo-directives library proposal

resources used to learn:

the proposed library aims to resolve this quote, and commonly shared opinion, from the Schema Directives docs:

...some of the examples may seem quite complicated. No matter how many tools and best practices you have at your disposal, it can be difficult to implement a non-trivial schema directive in a reliable, reusable way.