Skip to content

Instantly share code, notes, and snippets.

flipping bits...

andrew quartey drexler

flipping bits...
View GitHub Profile
HenningTimm /
Last active Mar 13, 2021
Memory profiling Rust code with heaptrack in 2019
alexellis /
Last active May 23, 2019
OpenFaaS Cloud Community Cluster instructions
pgolding /
Last active Dec 28, 2020
s3 bucket policy for presigned URLs generated by serverless lambda functions

AWS Presigned URLs

Presigned URLs are useful for fine-grained access control to resources on s3.

For example, if storing larger text blocks than DynamoDB might allow with its 400KB size limits s3 is a useful option.

Ignoring various ACL methods and using presigned URLs, it's possible to create lambda functions that can generate the required upload and download URLs.

Using the default IAM roles and lambda proxy configuration of serverless, lambdas are assigned an IAM role for the application (so that a logical group of functions can share resources - e.g. for a CRUD REST API). Each function then assumes the IAM role via its own function name.

tinovyatkin / promisify-readline-question.js
Created Oct 29, 2017
`util.promisify` for `readline.question`
View promisify-readline-question.js
'use strict';
// Promisifies readline.question function using node native `util.promisify`
// readline.question takes one callback that returns the answer, so it need custom promisifying
const readline = require('readline');
const { promisify } = require('util');
readline.Interface.prototype.question[promisify.custom] = function(prompt) {
return new Promise(resolve =>
Robbepop / .rustfmt.toml
Created Mar 16, 2017
.rustfmt.toml with all configs, descriptions, parameters and defaults for version 0.7.1 of rustfmt.
View .rustfmt.toml
# ----------------------------------------------------------------------------------
# r u s t f m t - C O N F I G
# ==================================================================================
# Version: 0.7.1
# Author : Robbepop <>
# A predefined .rustfmt.toml file with all configuration options and their
# associated description, possible values and default values for use in other
# projects.
coco-napky / hyper.js
Created Mar 8, 2017
Hyper config for git bash in Windows
View hyper.js
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 12,
// font family with optional fallbacks
fontFamily: 'Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.8)',
vlucas / encryption.js
Last active Apr 29, 2021
Stronger Encryption and Decryption in Node.js
View encryption.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv);
ziadoz /
Last active Apr 29, 2021
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# Versions
View uuidv4test.js
import { v4 as uuid } from 'uuid';
export function generateId() {
return uuid();
const v4 = new RegExp(/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i);