Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
set -e
if [ ! -e ".babelrc" ]; then
npm init
npm i webpack -S
cat >webpack.config.js <<EOF
var webpack = require('webpack');
@openfirmware
openfirmware / nginx-site.conf
Created May 2, 2016 18:08
nginx proxy to VLC HTTP stream to add CORS headers
server {
listen 8000;
server_tokens off;
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
#
# Custom headers and headers various browsers *should* be OK with but aren't
@joar
joar / jq-insert-var.sh
Last active March 8, 2025 21:45
Add a field to an object with JQ
# Add field
echo '{"hello": "world"}' | jq --arg foo bar '. + {foo: $foo}'
# {
# "hello": "world",
# "foo": "bar"
# }
# Override field value
echo '{"hello": "world"}' | jq --arg foo bar '. + {hello: $foo}'
{