Skip to content

Instantly share code, notes, and snippets.

View mmarcon's full-sized avatar
👋

Massimiliano Marcon mmarcon

👋
View GitHub Profile
@mmarcon
mmarcon / README.md
Created March 26, 2024 10:05
MongoDB Atlas Search Local Development

MongoDB Atlas Search local

This setup is loosely based on this except I removed the volumes used for data persistence as they were not needed here.

@mmarcon
mmarcon / mongosh-fle-local-kms.js
Last active February 17, 2021 16:57
Simple mongosh script to insert a document into MongoDB with Client-side Field-level Encryption and a local KMS.
// To run this script you can start the shell with `mongosh --nodb`
// Wrap everything into a function so we don't
// affect the shell's scope
(function insertTestData() {
// Config DB and Collection names
const dbName = '<TEST_DBNAME>';
const collectionName = '<TEST_COLLNAME>';
const mongoDBConnectionString = '<MONGODB_CONNECTION_STRING>';
@mmarcon
mmarcon / mongosh-fle-gcp-kms.js
Last active February 17, 2021 16:56
Simple mongosh script to insert a document into MongoDB with Client-side Field-level Encryption and KMS in GCP.
// To run this script you can start the shell with `mongosh --nodb`
// Wrap everything into a function so we don't
// affect the shell's scope
(function insertTestData() {
// Config DB and Collection names
const dbName = '<TEST_DBNAME>';
const collectionName = '<TEST_COLLNAME>';
const mongoDBAtlasConnectionString = '<MONGODB_ATLAS_CONNECTION_STRING>';
// MongoDB Playground
// To disable this template go to Settings | MongoDB | Use Default Template For Playground.
// Make sure you are connected to enable completions and to be able to run a playground.
// Use Ctrl+Space inside a snippet or a string literal to trigger completions.
// Select the database to use.
use('mongodbVSCodePlaygroundDB');
// The drop() command destroys all data from a collection.
// Make sure you run it against proper database and collection.
@mmarcon
mmarcon / youtube-helium.js
Last active November 11, 2016 09:18
A bookmarklet to convert youtube video links into links that can be opened with Helium on macOS (http://heliumfloats.com/)
[].slice.apply(document.querySelectorAll('.yt-lockup-title a.spf-link')).forEach(l => {const h = l.getAttribute('href'); l.setAttribute('href', `helium://https://www.youtube.com${h}`)})
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "forwarded_port", guest: 80, host: 8080
# No need to sync the vagrant folder, everything gets deployed
# with the ansible playbook
- name: link to Keymetrics
command: pm2 link {{ keymetrics_secret_key }} {{ keymetrics_public_key }}
when: keymetrics
become: yes
become_user: apps
ignore_errors: yes
tasks:
- name: install nginx
apt: name=nginx state=present update_cache=yes
notify:
- start nginx
- name: configure nginx
copy: src={{ item }} dest=/etc/nginx/sites-available/
with_fileglob:
- ./nginx/*
notify:
location /app {
proxy_pass http://localhost:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;