Skip to content

Instantly share code, notes, and snippets.

A/B Testing

Optimizely

click goals
measures how often visitors click an element

url targeting

// Base64 encode
val text = "This is plaintext."
val bytesEncoded = java.util.Base64.getEncoder.encode(text.getBytes())
// Base64 decode
val textDecoded = new String(java.util.Base64.getDecoder.decode(bytesEncoded))
println(textDecoded)
@jucke
jucke / fix_virtualenv
Created January 24, 2020 11:35 — forked from tevino/fix_virtualenv
Fix python virtualenv after python update
#!/usr/bin/env bash
ENV_PATH="$(dirname "$(dirname "$(which pip)")")"
SYSTEM_VIRTUALENV="$(which -a virtualenv|tail -1)"
BAD_ENV_PATHS="/usr/local"
echo "Ensure the root of the broken virtualenv:"
echo " $ENV_PATH"
@jucke
jucke / get_ssm_parameters.js
Created March 24, 2019 15:18 — forked from sonodar/get_ssm_parameters.js
Get secret parameters from Amazon EC2 Parameter Store
if (process.argv.length < 3) {
throw `Usage: ${process.argv[1]} path_prefix`
}
const PATH_PREFIX = process.argv[2]
const path = require('path')
const AWS = require('aws-sdk')
const ssm = new AWS.SSM()
function getParametersByPath(nextToken, callback) {
@jucke
jucke / README.md
Created March 29, 2018 13:30 — forked from magnetikonline/README.md
Install VirtualBox 5.1/5.2 guest additions on Ubuntu server guest.

Install VirtualBox guest additions onto Ubuntu server guests

Have tested these instructions successfully under an Ubuntu 16.04LTS guest with a VirtualBox 5.1 and 5.2 host.

Install steps

  • Create Ubuntu server instance under VirtualBox (obviously).
  • Start VM, goto Devices - Insert Guest Additions CD image to mount the ISO image.
@jucke
jucke / data-sets.md
Created December 24, 2017 00:09 — forked from campeterson/data-sets.md
Data sets
@jucke
jucke / number-prototype-iterator.js
Created September 12, 2017 20:46 — forked from getify/number-prototype-iterator.js
Make JavaScript Great Again
Object.defineProperty(Number.prototype,Symbol.iterator,{
*value({ start = 0, step = 1 } = {}) {
var inc = this > 0 ? step : -step;
for (let i = start; Math.abs(i) <= Math.abs(this); i += inc) {
yield i;
}
},
enumerable: false,
writable: true,
configurable: true
@jucke
jucke / web-servers.md
Created June 8, 2017 12:59 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@jucke
jucke / -
Created March 7, 2017 11:43 — forked from chrismdp/checkout.rb
def assert_equal(expected, actual)
print expected == actual ? "." : "Expected #{expected.inspect} but got #{actual.inspect}\n"
end
class SummingRule
def initialize(item, price)
@item = item
@price = price
end
@jucke
jucke / promises.md
Created October 27, 2016 20:55 — forked from domenic/promises.md
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.