Skip to content

Instantly share code, notes, and snippets.

View btd's full-sized avatar

Denis Bardadym btd

  • AWS
  • Deutschland, München
View GitHub Profile
const LOOKUP =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
export function encodeBase64(buffer) {
const view = new Uint8Array(buffer);
let out = [];
for (let i = 0; i < view.length; i += 3) {
const [b1, b2 = 0x10000, b3 = 0x10000] = view.subarray(i, i + 3);
out.push(
b1 >> 2,
@sindresorhus
sindresorhus / esm-package.md
Last active May 28, 2024 18:08
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@MatthewVance
MatthewVance / rclone.service
Created July 11, 2018 02:45
Rclone Systemd service
[Unit]
Description=rclone - rsync for cloud storage
Documentation=https://rclone.org/docs/
After=network-online.target
Before=caddy.service
Wants=network-online.target systemd-networkd-wait-online.service
Requires=caddy.service
[Service]
Restart=on-abnormal
@wsargent
wsargent / win10-dev.md
Last active March 21, 2024 04:27
Windows Development Environment for Scala

Windows 10 Development Environment for Scala

This is a guide for Scala and Java development on Windows, using Windows Subsystem for Linux, although a bunch of it is applicable to a VirtualBox / Vagrant / Docker subsystem environment. This is not complete, but is intended to be as step by step as possible.

Harden Windows 10

Read the entire Decent Security guide, and follow the instructions, especially:

@twolfson
twolfson / README.md
Last active August 1, 2023 10:45
Node.js job queue evaluation

We are building a Node.js service which will need asynchronous support for tasks like sending emails. Here's our evaluation:

@mkubenka
mkubenka / install.sh
Created April 23, 2016 19:28
OpenVPN Access Server Letsencrypt
#!/bin/sh
apt-get -y install git bc
git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
mkdir /etc/letsencrypt
/**
* Simple userland CPU profiler using v8-profiler
* Usage: require('[path_to]/CpuProfiler').init('datadir')
*
* @module CpuProfiler
* @type {exports}
*/
var fs = require('fs');
var profiler = require('v8-profiler');
@jjongsma
jjongsma / packer-config
Last active December 18, 2023 15:15
Process YAML and write Packer JSON to STDOUT
#!/usr/bin/python
#
# Usage: packer-config my-template.yaml | packer build -
#
# Constructs a Packer JSON configuration file from the specified YAML
# template file and writes it to STDOUT.
#
# The YAML template format adds some flexibility and readability by
# adding comments and an !include directive, allowing for the
# following template syntax:
@novemberborn
novemberborn / gist:6938771
Created October 11, 2013 17:30
Guide to setting up a local NPM registry

CouchDB

Install CouchDB. This guide assumes 1.3.1. Set up an admin account.

Create the database required by NPM:

curl -X PUT http://admin:password@127.0.0.1:5984/registry
@eiennohito
eiennohito / Tags.scala
Last active December 13, 2015 19:49
Support for scala.concurrent.Future in Lift REST.
object Converter extends Loggable {
implicit def scalaconcfuture2LiftResponse[T <% LiftResponse](fut: Future[T])(implicit ec: ExecutionContext): () => Box[LiftResponse] = {
RestContinuation.async { finish =>
fut.onComplete {
case Success(res) => finish(res)
case Failure(ex) =>
logger.error("error when completing request", ex)
finish(InternalServerErrorResponse())
}
}