Skip to content

Instantly share code, notes, and snippets.

Avatar
🤙

Daria piggydoughnut

🤙
View GitHub Profile
@piggydoughnut
piggydoughnut / mongodb-s3-backup.sh
Created Jul 6, 2018 — forked from eladnava/mongodb-s3-backup.sh
Automatically backup a MongoDB database to S3 using mongodump, tar, and awscli (Ubuntu 14.04 LTS)
View mongodb-s3-backup.sh
#!/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
@piggydoughnut
piggydoughnut / AWS_S3_File_Upload.js
Created Feb 12, 2018 — forked from homam/AWS_S3_File_Upload.js
How to upload files to AWS S3 with NodeJS SDK
View AWS_S3_File_Upload.js
var AWS = require('aws-sdk'),
fs = require('fs');
// For dev purposes only
AWS.config.update({ accessKeyId: '...', secretAccessKey: '...' });
// Read in the file, convert it to base64, store to S3
fs.readFile('del.txt', function (err, data) {
if (err) { throw err; }
@piggydoughnut
piggydoughnut / userAvatar.js
Created Feb 11, 2018 — forked from SylarRuby/userAvatar.js
NodeJs AWS S3 Upload
View userAvatar.js
/**
* This gist was inspired from https://gist.github.com/homam/8646090 which I wanted to work when uploading an image from
* a base64 string.
* This code is used in my startup, Zired.
* Web: http://zired.io
*/
// You can either "yarn add aws-sdk" or "npm i aws-sdk"
const AWS = require('aws-sdk')
@piggydoughnut
piggydoughnut / default
Created Feb 7, 2018 — forked from dtomasi/default
Brew Nginx PHP7
View default
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}
@piggydoughnut
piggydoughnut / README.md
Last active Feb 7, 2018 — forked from jimothyGator/README.md
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
View README.md
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/
@piggydoughnut
piggydoughnut / .sh
Last active Feb 7, 2018
GIT tricks
View .sh
git reset --hard origin/master
View Readme.md

So far I believe this is the best way to upload files from RN to node.js server. Seems very stable.