Skip to content

Instantly share code, notes, and snippets.

View ricardovf's full-sized avatar

Ricardo Fritsche ricardovf

View GitHub Profile
@ricardovf
ricardovf / watch.js
Created January 14, 2018 18:19 — forked from arleighdickerson/watch.js
hot reloading of server-side feathersjs application (put this in src/)
const logger = require('winston');
const invalidate = require('invalidate-module');
const { resolve } = require('path');
const chokidar = require('chokidar');
process.on('unhandledRejection', (reason, p) => {
logger.error('Unhandled Rejection at: Promise ', p, reason);
});
const src = (...args) => resolve(__dirname, ...args);
@ricardovf
ricardovf / backup-mongodb-to-s3.sh
Last active February 2, 2018 17:27 — forked from caraboides/backup-mongodb-to-s3.sh
Simple script to backup MongoDB to S3, without waste diskspace for temp files. And a way to restore from the latest snapshot.
#!/bin/sh
set -e
HOST=127.0.0.1
DB=lista_do_dia
AWS_ACCESS_KEY_ID=XXXX
AWS_SECRET_ACCESS_KEY=YYYY
S3PATH="s3://meritt-backups/mongodb/$DB/"
S3BACKUP=$S3PATH`date +"%Y%m%d_%H%M%S"`.dump.gz
AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY /usr/bin/aws s3 mb $S3PATH
@ricardovf
ricardovf / wget
Created April 4, 2018 19:02 — forked from jasperf/wget
Wget examples
#Spider Websites with Wget – 20 Practical Examples
Wget is extremely powerful, but like with most other command line programs, the plethora of options it supports can be intimidating to new users. Thus what we have here are a collection of wget commands that you can use to accomplish common tasks from downloading single files to mirroring entire websites. It will help if you can read through the wget manual but for the busy souls, these commands are ready to execute.
1. Download a single file from the Internet
wget http://example.com/file.iso
2. Download a file but save it locally under a different name
wget ‐‐output-document=filename.html example.com
@ricardovf
ricardovf / populate-zendesk-fields.js
Created July 12, 2019 14:16 — forked from stresslimit/populate-zendesk-fields.js
Pre-populate Zendesk new ticket fields via query params
jQuery(function($) {
if ( !$('#new_request') ) return
var query = window.location.search.substring(1);
var vars = query.split("&");
var match, fieldID;
for (var i=0; i<vars.length; i++) {
var pair = vars[i].split("=");
match = pair[0].match(/^request_fields\[([a-z_\d]+)\]$/)
if (match) {