Skip to content

Instantly share code, notes, and snippets.

View jeroenvollenbrock's full-sized avatar

Jeroen Vollenbrock jeroenvollenbrock

View GitHub Profile
@jeroenvollenbrock
jeroenvollenbrock / github-projects-style.css
Last active December 12, 2017 16:38
Stylish github projects
@-moz-document url-prefix("https://github.com/orgs/athombv/projects/") {
.project-column {
min-width: 275px;
max-width: 275px;
}
.project-columns-container {
height: height: calc(100vh - 121px);
}
@jeroenvollenbrock
jeroenvollenbrock / atlas_backup.sh
Created May 25, 2018 14:35
MongoDB Atlas backup downloader
#!/bin/sh -e
# backup sync script for mongo atlas
# requires api whitelist access
# depends on curl, jq and shasum (if verify is enabled)
USER=${ATLAS_USER:=$1}
KEY=${ATLAS_KEY:=$2}
GROUP=${ATLAS_GROUP:=$3}
CLUSTER=${ATLAS_CLUSTER:=$4}
//Usage: node simplemind2plantuml.js <path/to/smmx> > output.plantuml
//Requires fast-xml-parser and he npm modules
const xml = require('fast-xml-parser');
const he = require('he');
const fs = require('fs').promises;
function componentToHex(c) {
const hex = parseInt(c).toString(16);
return hex.length == 1 ? "0" + hex : hex;
}
@jeroenvollenbrock
jeroenvollenbrock / aws-cloudfront-basic-auth.js
Last active April 8, 2024 15:51
AWS-CloudFront-basic-auth
var USERS = {
protecteddir: [{
username: 'user',
password: 'pass',
}],
};
//Response when auth is not valid.
var response401 = {
statusCode: 401,
@jeroenvollenbrock
jeroenvollenbrock / slack-bulk-bot.js
Created September 30, 2022 17:07
Slack Bulk Bot
// README
// GO TO https://api.slack.com/apps?new_app=1, select from scratch, give the app a name and pick a workspace
// GO TO OAuth & Permissions, Oauth permissions -> Scopes, add chat:write and users:read to user scopes
// Press "install to workspace" at the top of the page, approve and copy User OAuth Token
// Go to Google sheets, create a new sheet, press Extentions -> Apps Script, Copy this code, press save, press execute
// Go back to Google Sheets, select Slack -> Initialize and paste the User OAuth token
// Fill out the input sheet with names (or user names), and messages you can use $firstname and $lastname placeholders, but it may be empty
// Press Slack -> Send to Recipients, confirm and watch while the status column is populated, the status column must be empty
const LOOKUP_TPL = [
const SHEET_TPL = [
'Nick Name',
'Project Name',
'Job Name',
'Approved',
'Draft',
'Not Submitted',
'Pending',
'Total Hours',
'Billable',
@jeroenvollenbrock
jeroenvollenbrock / index.mjs
Last active April 12, 2024 15:45
AWS Proxy Lambda
const TARGET = process.env.TARGET_BASE_URL;
export const EXCLUDED_HEADERS = [
'accept-encoding',
'connection',
'content-encoding',
'content-length',
'host',
'server',
'transfer-encoding',