Skip to content

Instantly share code, notes, and snippets.

Avatar

Carlos A. F. Santos calfersantos

View GitHub Profile
@devjourney
devjourney / CreateCosmosDbAuthTokenInPostman.js
Created August 31, 2018 23:58
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 July 17, 2017 15:39
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];
@mganeko
mganeko / parse_webm.js
Last active April 23, 2022 13:03
Parse Binary of WebM file with Node.js
View parse_webm.js
//
// This code parses binary format of WebM file.
// recognizes only some important TAGs
//
// Limitation:
// This programs reads all binary at once in memory (100MB).
// It is very bad imprementation, but it is still enough for some small WebM file.
//
// Usage:
// node parse_webm.js filename
@threepointone
threepointone / durable-objects-001-fundamentals.md
Last active February 3, 2023 06:59
Notes on Durable Objects. Part 1 - Migrations.
View durable-objects-001-fundamentals.md

Note: Since writing this, I've been pointed to some exciting new research/tooling called Project Cambria https://www.inkandswitch.com/cambria.html I'll likely have to rewrite this article taking that into account. Leaving this up for posterity's sake.


(This series isn't meant to be a primer/tutorial, though we might do something regarding it in the future. For official documentation and starters, see https://developers.cloudflare.com/workers/learning/using-durable-objects.

Further - these are my personal views; I expect to be wrong about a lot of them. Indeed, I'm not paying much attention to presenting these well at the moment, simply writing down thoughts. As such, expect these writeups to change often, particularly as the platform takes shape. I'm also mostly a front end guy, so don't get mad if I get it very wrong. Give me feedback! Always happy to learn and make changes.)

Durable Objects are a fascinating new storage primitive from cloudflare for their workers platform. There's a lot of 'cool'

@ipepe
ipepe / install-chrome-headless.sh
Last active March 29, 2023 02:20
Installing headless chrome on Ubuntu.
View install-chrome-headless.sh
#!/bin/bash
# from https://chromium.woolyss.com/
# and https://gist.github.com/addyosmani/5336747
# and https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:canonical-chromium-builds/stage
sudo apt-get update
sudo apt-get install chromium-browser
chromium-browser --headless --no-sandbox http://example.org/
@kevincennis
kevincennis / v8.md
Last active June 2, 2023 06:06
V8 Installation and d8 shell usage
View v8.md

Installing V8 on a Mac

Prerequisites

  • Install Xcode (Avaliable on the Mac App Store)
  • Install Xcode Command Line Tools (Preferences > Downloads)
  • Install depot_tools
    • $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
    • $ nano ~/.zshrc
    • Add path=('/path/to/depot_tools' $path)