This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useState, useCallback } from "react" | |
import { Animated, StyleSheet, View } from "react-native" | |
type ProgressBarProps = { | |
height?: number | |
progress?: number | |
animated?: boolean | |
indeterminate?: boolean | |
progressDuration?: number | |
indeterminateDuration?: number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Types } from "mongoose" | |
interface X { | |
_id: Types.ObjectId | |
} | |
const id1 = new Types.ObjectId() | |
const id2 = new Types.ObjectId() | |
const id3 = new Types.ObjectId() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add the `replication` section to the mongod.conf file: | |
``` | |
$cat /usr/local/etc/mongod.conf | |
systemLog: | |
destination: file | |
path: /usr/local/var/log/mongodb/mongo.log | |
logAppend: true | |
storage: | |
engine: mmapv1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There are two parts to this: | |
1. The main Python code that uses requests + json to parse the events | |
2. The external Jinja2 template that the data is rendered by, producing the HTML output | |
# ---------------------------------------------------------------------------------------------------------------- | |
#!/usr/bin/env python3 | |
import json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
nvm install --lts --reinstall-packages-from=$(nvm current) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ -z "$1" || -z "$2" ]] | |
then echo -e "Usage: clone-collection.sh <db> <collection>"; exit 1 | |
fi | |
# clones a mongodb collection and its indexes into __collection__ | |
mongodump -v -d $1 -c $2 --out=- | mongorestore -v -d $1 -c __$2__ --drop --dir=- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import IORedis from "ioredis" | |
import { Queue, QueueScheduler, Job, Worker } from "bullmq" | |
const main = async (): Promise<void> => { | |
const qs = new QueueScheduler("Paint", { | |
connection: new IORedis(), | |
}) | |
const qPaint = new Queue("Paint", { | |
connection: new IORedis(), | |
defaultJobOptions: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// only one job is added despite removeOnComplete: true | |
import { Queue, QueueScheduler, Job, Worker } from "bullmq" | |
const now = () => `[${new Date().toISOString()}]` | |
const queue = new Queue("Paint", { | |
defaultJobOptions: { | |
removeOnComplete: true, | |
}, | |
}) |
NewerOlder