Skip to content

Instantly share code, notes, and snippets.

Avatar

Carlos A. F. Santos calfersantos

View GitHub Profile
@devjourney
devjourney / CreateCosmosDbAuthTokenInPostman.js
Created Aug 31, 2018
Create an authorization token for CosmosDB in a Postman Pre-test Script
View CreateCosmosDbAuthTokenInPostman.js
var now = new Date().toUTCString();
pm.environment.set("utcDate", now);
var verb = 'GET';
var resourceType = pm.variables.get("resourceType");
var resourceId = pm.variables.get("resourceId");
var text = (verb || "").toLowerCase() + "\n" + (resourceType || "").toLowerCase() + "\n" + (resourceId || "") + "\n" + now.toLowerCase() + "\n" + "" + "\n";
var key = CryptoJS.enc.Base64.parse(pm.variables.get("masterKey"));
var signature = CryptoJS.HmacSHA256(text, key).toString(CryptoJS.enc.Base64);
@adamotte
adamotte / deezer-mp3-download.js
Created Jul 17, 2017
Download - stream a deezer song / playlist / album in 320kbps, for educational purposes only ;). Strongly inspired by https://github.com/jaimehrubiks/deezer-download
View deezer-mp3-download.js
const Promise = require("bluebird");
const request = require("request-promise");
const ID3Writer = require('browser-id3-writer');
const crypto = require('crypto');
const format = require('util').format;
const fs = require("fs");
const http = require('http');
let type = process.argv[2];