Skip to content

Instantly share code, notes, and snippets.

@eladnava
eladnava / mongodb-s3-backup.sh
Last active March 11, 2024 10:21
Automatically backup a MongoDB database to S3 using mongodump, tar, and awscli (Ubuntu 14.04 LTS)
#!/bin/sh
# Make sure to:
# 1) Name this file `backup.sh` and place it in /home/ubuntu
# 2) Run sudo apt-get install awscli to install the AWSCLI
# 3) Run aws configure (enter s3-authorized IAM user and specify region)
# 4) Fill in DB host + name
# 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket)
# 6) Run chmod +x backup.sh
# 7) Test it out via ./backup.sh
@eladnava
eladnava / private.xml
Last active September 5, 2016 20:23
Karabiner private.xml for volume and music playback controls using F13 - F19 keys on wired Apple Keyboard
<?xml version="1.0"?>
<root>
<item>
<name>F19 to Sleep</name>
<identifier>Sleep</identifier>
<autogen>
__KeyToKey__
KeyCode::F19,
KeyCode::VK_CONSUMERKEY_EJECT, ModifierFlag::OPTION_L | ModifierFlag::COMMAND_L
</autogen>
exec > /tmp/${PROJECT_NAME}_archive.log 2>&1
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
if [ "true" == ${ALREADYINVOKED:-false} ]
then
echo "RECURSION: Detected, stopping"
else
export ALREADYINVOKED="true"
@eladnava
eladnava / server.js
Created November 13, 2020 04:28
Get Facebook Ads Lead Notifications in Realtime with Node.js
const axios = require('axios');
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
const port = 3000;
// Enter the Page Access Token from the previous step
const FACEBOOK_PAGE_ACCESS_TOKEN = '_______________________________';