Skip to content

Instantly share code, notes, and snippets.

View n370's full-sized avatar

Dylson Valente Neto n370

View GitHub Profile
#!/bin/bash
curl -v -F "arquivoXml=@/nota.xml" https://arvixe.webdanfe.com.br/danfe/GeraDanfe.php -o /nota.pdf
@n370
n370 / convert.sh
Created March 2, 2016 08:34 — forked from anonymous/convert.sh
Convert WAV file to MP3 using FFMPEG
#!/bin/bash
ffmpeg -i FILE.WAV -ab 192k FILE.mp3
@n370
n370 / node_hex_string.sh
Created February 1, 2016 18:09
Create a 16 bytes hexadecimal string with node
#! /env/node
node -p "require('crypto').randomBytes(16).toString('hex')"
@n370
n370 / router.js
Last active January 5, 2016 02:44
Issue with FlowRouter
FlowRouter.route('/product/:id', {
name: 'product',
action(params) {
let product = Products.findOne({_id: new Mongo.ObjectID(params.id)});
/**
* Will return undefined after a browser refresh, although
* sometimes it seems to work fine. However, if activated
* by FlowRouter.go('product', {id: "a valid id string"})
* will return a collection document as expected
@n370
n370 / template.html.ejs
Last active September 16, 2015 16:06
An EJS template.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hacker Assessor</title>
</head>
<body>
<h1>This is the Hacker Assessor landing page</h1>
<h1><small>It features an awesome list of hackers.</small></h1>
<ul>
@n370
n370 / error
Last active August 29, 2015 14:26
Loading a JSON inside a meteor app.
W20150804-10:50:47.375(-3)? (STDERR)
W20150804-10:50:47.376(-3)? (STDERR) /Users/n370/.meteor/packages/meteor-tool/.1.1.4.rpwbv7++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:278
W20150804-10:50:47.376(-3)? (STDERR) throw(ex);
W20150804-10:50:47.376(-3)? (STDERR) ^
W20150804-10:50:47.402(-3)? (STDERR) Error: socket hang up
W20150804-10:50:47.402(-3)? (STDERR) at Object.Future.wait (/Users/n370/.meteor/packages/meteor-tool/.1.1.4.rpwbv7++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:398:15)
W20150804-10:50:47.402(-3)? (STDERR) at Object.call (packages/meteor/helpers.js:119:1)
W20150804-10:50:47.402(-3)? (STDERR) at Object.HTTP.get (packages/http/httpcall_common.js:45:1)
W20150804-10:50:47.402(-3)? (STDERR) at app/model/products.js:10:19
W20150804-10:50:47.402(-3)? (STDERR) at app/model/products.js:14:3
@n370
n370 / myDirective.js
Created June 30, 2015 20:52
The npm module gulp-ng-annotate don't annotate my controller function.
angular.module('dashboard')
/**
* This directive creates the Settings Form.
* @summary Usage: <printer-settings settings=[MultidimensionalArray]></printer-settings>
*/
.directive('printerSettings', function($filter, $timeout, RecursionHelper) {
'use strict';
return {
scope: {
@n370
n370 / pretty_json_res
Created June 16, 2015 17:19
Pretty prints curl's JSON response.
#! /bin/bash
curl -H "Content-Type: application/json" -X POST -d '{"some":"json"}' https://my.endpoin.net/ | python -m json.tool
@n370
n370 / edit_the_last
Last active August 29, 2015 14:22
Edit the last file inside a directory.
#! /bin/bash
vim $(ls * | sort -rdn | head -n 1)
@n370
n370 / 20150309_firebase_batch_push.md
Last active June 21, 2020 19:57
Using jq, HTTPie and the Firebase REST API to push JSON objects from your terminal.

Using jq, HTTPie and the Firebase REST API to push JSON objects from your terminal.

Imagine a scenario where you've been developing locally with dummy data and at some point decided to move this data to a Firebase instance.

Assuming your JSON file contents looks like the following.

[ 
  {
    "name": "Zapallo Anco",