Skip to content

Instantly share code, notes, and snippets.

version: '3'
services:
vector:
image: timberio/vector:0.11.1-alpine
ports:
- "9090:9090"
- "7780:7780"
volumes:
- ./vector.toml:/etc/vector/vector.toml:ro
metrics:
@benzaita
benzaita / print-to-stdout-and-stderr.sh
Last active December 3, 2019 13:49
Groovy for Shell Scripting - Workshop
#!/usr/bin/env bash
echo "Hello on STDOUT!" | base64
echo "Hello on STDERR!" >&2
exit 1
@benzaita
benzaita / README.md
Last active July 4, 2018 12:19
How to upload JS source-maps to sentry.io
  1. Set up webpack to generate source-maps.
  2. Set release: process.env.RELEASE_NAME when configuring raven-js.
  3. Upload the source maps and the minified JS bundle to sentry, e.g. using sentry-cli, providing the same RELEASE_NAME.
  4. Generate some errors.
  5. Enjoy full stack-traces.

Note: do not forget to upload the minified JS bundle. It's not clear from the documentation that this is needed, but it is :-|

@benzaita
benzaita / example.js
Created October 9, 2017 10:44
ramda-recursively
const { reject, isNil } = require('ramda')
const recursively = require('ramda-recursively')
expect(recursively(reject(isNil))({
a: 2,
b: null,
c: undefined,
d: [
null,
{
@benzaita
benzaita / Makefile
Last active August 31, 2017 15:01
Test an Ansible role with one command
test:
vagrant status | grep -q 'default.*running' || vagrant up
vagrant rsync
vagrant ssh -c "\
cd /tmp/test && \
sudo ansible-role role-under-test"
clean:
vagrant destroy
@benzaita
benzaita / README.md
Last active August 14, 2017 11:35
Troubleshooting An Obscure Webpack Error

The error:

static/preview.e7d69d48168df1c0fed7.bundle.js from UglifyJs
Unexpected token: operator (>) [static/preview.e7d69d48168df1c0fed7.bundle.js:57983,27]

Specifically, this error occurs because UglifyJs cannot parse ES2016 syntax. I checked my .babelrc file, and it did contain the es2015 preset, so Babel should have transpiled the code to ES2015.

Seems like some module did not get transpiled. But how can we find out which?

defered_code="set +e"
function defer_to_exit {
local command="$@"
defered_code="$defered_code; $command"
}
trap 'eval $defered_code' EXIT
function find_local_machine_ip {
ifconfig | grep -E 'inet [0-9.]+ netmask' | awk '{print $2}' | grep -Fv 127.0.0.1
}
function find_docker_host_ip {
local docker_machine_ip=$(docker-machine ip dev 2>/dev/null)
if [[ -n $docker_machine_ip ]]; then
echo $docker_machine_ip
else
@benzaita
benzaita / post-open-prs-to-slack
Created June 27, 2017 11:32
Post open pull-request from BitBucket (Stash) to Slack
#!/usr/bin/env NODE_TLS_REJECT_UNAUTHORIZED=0 node
const request = require('request-promise')
const yargs = require('yargs')
.option('u', {
alias: 'stashUsername',
demand: true
})
.option('p', {
alias: 'stashPassword',
@benzaita
benzaita / gco
Created June 25, 2017 06:54
git checkout with partial branch name
#!/bin/bash
ticket=$1
if [[ "$ticket" == "" ]]; then
echo "Usage: $0 <PARTIAL BRANCH NAME>"
exit 1
fi
declare -a branches