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
@j-mcnally
j-mcnally / Readme
Created August 18, 2011 22:04
Express: Switch cookie sessions to a header session fore Node Apps built as APIs
The two files attached are Express Middleware
Srvformat sets the format based on the accept header
to switch it to api mode.
ApiSession uses the req.format set by this to decide
which kinds of sessions to use.
@btd
btd / fib.scala
Created October 16, 2011 14:16
One line fib numbers without recursion and scala.math
val fib = (n:Int) => (0 until n).foldLeft(0, 1) { (x, i) => (x._2, x._1 + x._2) }._1
@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())
}
}
@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
@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:
/**
* 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');
@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
@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:

@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:

@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