Skip to content

Instantly share code, notes, and snippets.

@qgustavor
qgustavor / bridge-bookmarklet.md
Created June 17, 2016 15:51
WhatsApp Message Bridge

Copy the snippet below as a bookmarklet in order to use it:

javascript:(function(){var a=prompt("> WhatsApp Message Bridge <\nAutomatically send messages from one chat to other.\nEnter with the source and destination chat names separating those with one vertical bar (|).");if(a){var c=a.split("|")[0].trim(),d=a.split("|")[1].trim(),a=Store.Chat.models.find(function(a){return a.name===c}),b=Store.Chat.models.find(function(a){return a.name===d});if(a&&b)a.msgs.on("add",function(a){b.sendMessage(a.body)});else alert("One or more of the chats were not found. Try again.")}})();void 0;

@qgustavor
qgustavor / multi_dashboard.html
Created July 12, 2016 12:32 — forked from battlehorse/multi_dashboard.html
A Google Charts dashboard setup where multiple datatables are used to power a single 'logical' dashboard.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>
Google Visualization API Sample
</title>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['controls']});
@qgustavor
qgustavor / index.js
Last active July 25, 2016 17:50 — forked from MattMcFarland/index.js
requirebin sketch
const choo = require('choo')
const html = require('choo/html')
const app = choo()
app.model({
state: { newValue: '', videos: [] },
reducers: {
add: (action, state) => ({
newValue: '',
videos: [action.value || state.newValue]
@qgustavor
qgustavor / _gistfile1.md
Last active August 11, 2016 11:54 — forked from ciaranj/gist:9056285
A *working* (on Windows) UDP Multicast client & server with Node.Js v0.10.25 (I spent a *LOT* of time getting EINVAL and I still don't quite know why :/)
// Generate 256 emoji map
const map = '002v2x2z3033354n5v7t848n7o7t'.match(/..../g).reduce((s,e,l)=>{
l = parseInt(e.substr(2), 36);
e = parseInt(e.substr(0, 2), 36);
while(e < l) {
s.push(String.fromCodePoint(127789 + e++));
}
return s;
}, []);
// In case of "Exceeded maximum execution time" retry after some time
// Copied files and folders will not be copied again
// Changes:
// - Don't "search" for source and target folders
// - Inline some variables (to make it run faster)
// - Avoid Logger when possible (it can make script slower)
function start() {
var source = DriveApp.getFolderById('get-source-folder-id-in-link');
@qgustavor
qgustavor / nicotube.user.js
Last active July 20, 2017 18:07
YouTube with NicoVideo comments
// ==UserScript==
// @version 1.1.0
// @name NicoTube Comments
// @namespace https://github.com/qgustavor
// @description YouTube with NicoVideo comments
// @match https://www.youtube.com/watch?v=*
// @run-at document-end
// @noframes
// ==/UserScript==
@qgustavor
qgustavor / convert-server.js
Created November 30, 2016 15:13
Single file MP3 to OGG ffmpeg convertion server
// based on https://gist.github.com/ryanflorence/701407
var http = require('http')
var url = require('url')
var path = require('path')
var fs = require('fs')
var cp = require('child_process')
var port = process.argv[2] || 8888
http.createServer(function (request, response) {
### Keybase proof
I hereby claim:
* I am qgustavor on github.
* I am qgustavor (https://keybase.io/qgustavor) on keybase.
* I have a public key whose fingerprint is 160B C154 EB83 5563 A041 4C14 EF30 547D C9D2 9AAB
To claim this, I am signing this object:
// based on http://stackoverflow.com/q/38275326 and MEGA source code
const crypto = require('crypto')
function decodeBase64 (data) {
data += '=='.substr((2 - data.length * 3) & 3)
data = data.replace(/\-/g, '+').replace(/_/g, '/').replace(/,/g, '')
return Buffer.from(data, 'base64')
}
function decodeAttributes (at) {