Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am neztore on github.
  • I am joshmuir (https://keybase.io/joshmuir) on keybase.
  • I have a public key ASD9F6udkDuFfjxPyW1xAJIAUt5IV2yE9Dor3e2z_aHGQgo

To claim this, I am signing this object:

@Neztore
Neztore / timeout.js
Created January 12, 2022 01:38
Promise timeout replacement
class TimeoutError extends Error {
}
/**
* A basic replacement for the Bluebird 'timeout' method. Returns a Promise which will resolve or reject with the result of the given
* promise once it resolves, or reject if the promise should fail to resolve within the supplied timeout. An optional reason
* can also be supplied.
* @param promise - The Promise to apply a timeout to.
* @param timeoutTime - The timeout to apply to the Promise.
* @param reason - Optional String reason for the timeout.
@Neztore
Neztore / gyazo-download.js
Created December 3, 2020 01:39
Basic gyazo image downloader to clone all of your images, minus any meta-data.
/*
Basic Gyazo file downloader.
How-to-use:
1. Dependencies
Ensure you are using a recent version of node (tested w/ node v12)
Install node-fetch
2. Folder
Create an "imgs" folder in your current directory
3. Cookie
// Includes
var http = require('../util/http.js').func
var getGeneralToken = require('../util/getGeneralToken.js').func
// Args
exports.required = ['group']
exports.optional = ['sortOrder', 'limit', 'cursor', 'jar']
// Define
function getJoinRequests (jar, group, sortOrder, limit, cursor) {
/*
Requires:
- Node-Fetch
- "cookie" variable to be defined
- "groupId" to be set
Generates typescript interfaces from group Audit logs by using typeof to determine the type of response values.
Can only generate interfaces for actions which have occured for a given group before.
*/
const cookie = "";
Remove Member:
TargetId: number
TargetName: string
--------
Delete Post:
PostDesc: string
TargetId: number
@Neztore
Neztore / fullExport.js
Created June 16, 2020 00:14
Exports all databases contained within a rethinkdb database
/*
Exports all databases and tables. Stores in folders according to to "date" in a similar format to npm logs
Dates are UTC but do not contain the timezone offset.
Uses streams to try and avoid storing massive tables in memory, but the way this is done is a bit "Hacky" so be aware of that.
(I manually write commas and array [] parts)
By default ignores the "test" db.
Dependencies:
* rethinkdbdash
*/
// Manages interface with the verification service
const fetch = require("node-fetch");
const { verificationApi } = require("../../settings");
module.exports = {
getLink: async function (discordId) {
const resp = await makeRequest(`/api/roblox/${discordId}`);
if (resp.error && resp.error.status === 404) {
return false;
} else if (resp.error) {
// Build file
// This file is executed by Netlify and used to build EJS to static HTML for serving.
const ejs = require("ejs");
const { join } = require("path");
const { readdir, writeFile, stat, mkdir, watch, unlink } = require("fs");
const outputDir = join(__dirname, "public", "pages");
const pagesDir = join(__dirname, "src", "pages");
// Doesn't affect admin since it's not built with EJS