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 { graphql } from 'gatsby' | |
import React from 'react' | |
import { Helmet } from 'react-helmet' | |
import styled from 'styled-components' | |
export const pageQuery = graphql` | |
query PostById( | |
$id: String | |
) { | |
wpPost(id: { |
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
// npm install sqs-consumer | |
const { Consumer } = require('sqs-consumer') | |
const app = Consumer.create({ | |
queueUrl: "SQS_URL", | |
handleMessage: async (message) => { | |
// Do stuff | |
} | |
}); |
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, { useState, useEffect, useContext } from 'react' | |
import styled from 'styled-components' | |
import copy from "copy-to-clipboard"; | |
import { GlobalContext } from '../../contexts/GlobalContext' | |
import Loading from "../../components/Loading" | |
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' | |
import Stat from '../../components/build/Stat' | |
import SubclassCard from '../../components/build/SubclassCard' | |
import ItemCard from '../../components/build/ItemCard' | |
import UpvoteButton from '../../components/build/UpvoteButton'; |
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
const axios = require('axios') | |
const fs = require('fs') | |
const { PDFImage } = require('pdf-image') | |
const { createWorker } = require('tesseract.js') | |
async function ocrStuffz(fileName) { | |
let pdfImage = new PDFImage(fileName, { combinedImage: true }) | |
let convertedImage = await pdfImage.convertFile() | |
const worker = createWorker({ |
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
// Usage: | |
// const DiscordLogger = require('./path/to/file.js') | |
// const logger = new DiscordLogger('my app name', 'https://discord.webhook/here'); | |
// await logger.info('some message'); | |
const axios = require('axios'); | |
const COLORS = { | |
ERROR_RED: 16196387, | |
DEBUG_PURPLE: 12666618 |
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
from notion.client import NotionClient | |
import requests | |
import schedule | |
import time | |
from datetime import datetime | |
def get_todoist_tasks(): | |
token = "todoist_token" | |
headers = { |
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
const { adapter } = require('./lambdaAdapter') | |
exports.handler = async (event, context) => await adapter(event, context, options) |
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
# -Tail grabs the previous N lines, -Wait will watch the file and log out the changes to the session. | |
Get-Content ./mylog.log -Tail 5 –Wait |
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
function getDataUrl(file) { | |
return new Promise((resolve, reject) => { | |
var reader = new FileReader(); | |
reader.readAsDataURL(file); | |
reader.onload = () => resolve(reader.result); | |
reader.onerror = err => reject(err); | |
}); | |
}; |
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
# Source: https://hub.docker.com/_/mongo | |
# Use root/example as user/password credentials | |
version: '3.1' | |
services: | |
mongo: | |
image: mongo | |
restart: always | |
# You can uncomment this to set a password, but I use it locally with no auth for testing. |