Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Jonathan Prass Martins jonathanpmartins

🏠
Working from home
View GitHub Profile
@jonathanpmartins
jonathanpmartins / subsetSum.js
Created Aug 13, 2021 — forked from rbarilani/subsetSum.js
Finding all possible combinations of numbers to reach a given sum ()
View subsetSum.js
function subsetSum(numbers, target, partial) {
var s, n, remaining;
partial = partial || [];
// sum partial
s = partial.reduce(function (a, b) {
return a + b;
}, 0);
@jonathanpmartins
jonathanpmartins / encrypt-chrome-notification-payload.js
Created Apr 26, 2016
Simple Node server to encrypt Chrome 50 Payloads
View encrypt-chrome-notification-payload.js
var http = require('http');
var encrypt = require('./encrypt');
function processPost(request, response, callback) {
var queryData = "";
if(typeof callback !== 'function') return null;
if(request.method == 'POST') {
request.on('data', function(data) {
queryData += data;
@jonathanpmartins
jonathanpmartins / install-libsodium.sh
Last active Jul 28, 2019
Install Libsodium on Ubuntu 14.04.3 LTS Trusty
View install-libsodium.sh
#!/bin/bash
sudo add-apt-repository ppa:chris-lea/libsodium;
sudo echo "deb http://ppa.launchpad.net/chris-lea/libsodium/ubuntu trusty main" >> /etc/apt/sources.list;
sudo echo "deb-src http://ppa.launchpad.net/chris-lea/libsodium/ubuntu trusty main" >> /etc/apt/sources.list;
sudo apt-get update && sudo apt-get install libsodium-dev;
@jonathanpmartins
jonathanpmartins / install-libsodium.sh
Last active Sep 14, 2017 — forked from sarciszewski/install-libsodium.sh
Install libsodium-1.0.2 and PECL libsodium on Ubuntu 14.04
View install-libsodium.sh
#!/usr/bin/env bash
PECLVER="0.1.1"
LIBSODIUMVER="1.0.2"
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
View supervidor-sample-config.conf
; Sample supervisor config file.
;
; For more information on the config file, please see:
; http://supervisord.org/configuration.html
;
; Notes:
; - Shell expansion ("~" or "$HOME") is not supported. Environment
; variables can be expanded using this syntax: "%(ENV_HOME)s".
; - Comments must have a leading space: "a=b ;comment" not "a=b;comment".
View ClearBeanstalkdQueueCommand.php
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class ClearBeanstalkdQueueCommand extends Command {
/**