Skip to content

Instantly share code, notes, and snippets.

View vnugent's full-sized avatar

Viet Nguyen vnugent

View GitHub Profile
db.pandas.find({}, {_id: 1, title: 1, meta: 1}).sort({insert_ts: -1})
# enable featured post
db.pandas.update({_id: {$in: ["<uuid>"]}}, {$set: {'meta.featured': "true"}}, false, true)
@vnugent
vnugent / Digital-ocean-cheatsheet.txt
Last active October 28, 2019 14:06
Digital Ocean K8s cheatsheet
Step 1 - Config `kubectl` client to work with a new cluster
1. Download cluster yaml config from K8s dashboard
2. `export KUBECONFIG=~/.kube/config:<new yaml file>`
3. `kubectl config view --flatten > config.new`
4 Remove ~/.kube/config. Rename config.new to config
kubectl config get-contexts
kubectl config use-context <new context>
Step 2 - Add K8s cluster to Gitlab

DigitalOcean droplets

#/etc/dnsmasq.d/origin-dns.conf
server=67.207.67.2
server=67.207.67.3

Errors

import React, { useEffect, useState } from "react"
import {
Grid,
AppBar,
Toolbar,
Container,
Divider,
Paper,
Drawer,
Button,
@vnugent
vnugent / yds-utils.js
Last active September 21, 2020 16:39
Yosemite Decimal System validator & comparator
// match 5.0 up to 5.15 including + and -. Example: 5.10+ or 5.12-
const REGEX_5_X = RegExp(/^5\.([0-9]|1[0-5])([+-]?)$/);
// match 5.10x to 5.15x. Example: 5.12c
const REGEX_5_10_LETTER = RegExp(/^5\.(1[0-5])([abcd])(?:\/[abcd])?$/);
/**
* Test if a grade string is in valid format
* @param {yds} grade
*/
import { unified } from "unified";
import markdown from "remark-parse";
import slate, { defaultNodeTypes, serialize } from "remark-slate";
const DEFAULT_HEADINGS = {
1: "h1",
2: "h2",
3: "h3",
4: "h4",
5: "h5",
@vnugent
vnugent / plate-custom-normalizer.js
Created November 15, 2021 13:12
Create your own Platejs plugin
// createCustomNormalizingPlugin.js
import { getChildren } from "@udecode/plate-common";
import { getPlatePluginWithOverrides, isElement } from "@udecode/plate-core";
const withCustomNormalizing = (options) => (editor) => {
const { normalizeNode } = editor;
editor.normalizeNode = ([node, path]) => {
//console.log("#foos ", node);
@vnugent
vnugent / climbing-destinations.md
Created April 9, 2022 20:10
US climbing destinations

Connect to OpenBeta graphql

Go to https://graphiql-online.com/graphiql

Endpoint: https://api.openbeta.io

query MyQuery {
 areas(filter: {field_compare: [{num: 0.5, field: density, comparison: gt}, {num: 400, field: totalClimbs, comparison: gt}], path_tokens: {tokens: "California"}}, sort: {density: -1}) {
@vnugent
vnugent / california-climbing-destinations.json
Created April 9, 2022 20:13
Possible climbing destinations in CA
{
"data": {
"areas": [
{
"pathTokens": [
"US",
"California",
"Sierra Eastside",
"Bishop Area",
"Volcanic Tablelands (Happy/Sad Boulders)",