Skip to content

Instantly share code, notes, and snippets.

View dresende's full-sized avatar
🇺🇦
Free Ukraine

Diogo Resende dresende

🇺🇦
Free Ukraine
View GitHub Profile
From https://synocommunity.com add http://packages.synocommunity.com to your NAS package sources.
For that, go to NAS->Package Cnter->Click Settings->Package Sources tab.
Then from the community, you can see Mosquitto. Install it.
After installing, please stop the Mosquitto service before updating configuration. You can start service after changes.
Enable Admin login for Synology
Enable SSH in NAS
Download putty and connect to NAS Server
Login using admin
Change to root user [sudo -i, {use admin password}]
Find mosquitto.conf file [find / -name mosquitto.conf]
const people = [
{ name: "John", ranking: 3 },
{ name: "Jane", ranking: 8 },
{ name: "Joe", ranking: 2 },
{ name: "Jessica", ranking: 9 },
];
console.log("average", rank_avg(people));
console.log("sorted", rank_sort(people).map((person) => (person.name)));
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dresende
dresende / index.js
Created September 29, 2015 21:49
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
var modbus = require("modbus-tcp");
var client = new modbus.Client();
var server = new modbus.Server();
// link client and server streams together
client.writer().pipe(server.reader());
server.writer().pipe(client.reader());

Keybase proof

I hereby claim:

  • I am dresende on github.
  • I am dresende (https://keybase.io/dresende) on keybase.
  • I have a public key whose fingerprint is CFBD 875A 4D0B 2D43 6A86 72F9 1166 9F08 1BBF 85CA

To claim this, I am signing this object:

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dresende
dresende / fetch_pull_request.sh
Created June 5, 2013 09:28
Fetch a single github pull request
# fetch pull request N to (new) localbranch
git fetch origin pull/N/head:localbranch
<?xml version="1.0" encoding="utf-8"?>
<Root>
<type>OF</type>
<output>archive</output>
<uid>13557592400997</uid>
<OF>
<Number>86799</Number>
<Date>2012-11-28 16:46:15</Date>
<DeliveryDate>2013-08-20</DeliveryDate>
<WeekNumber>34</WeekNumber>
@dresende
dresende / output.txt
Created October 2, 2012 15:12
Using momentjs and node-time, having an UTC date, format it in any timezone
# this was runned on the first dates below (Oct 2 2012, 3:10 PM UTC)
UTC: Tuesday, October 2 2012 3:10 PM
LX: Tuesday, October 2 2012 4:10 PM
NY: Tuesday, October 2 2012 11:10 AM
TKY: Wednesday, October 3 2012 12:10 AM
3 months later...
UTC: Wednesday, January 2 2013 3:10 PM
LX: Wednesday, January 2 2013 3:10 PM
@dresende
dresende / ldapjs-addrbook.js
Created August 26, 2011 18:06
LDAP Addressbook using ldapjs
// MySQL test: (create on database 'abook' with username 'abook' and password 'abook')
//
// CREATE TABLE IF NOT EXISTS `users` (
// `id` int(5) unsigned NOT NULL AUTO_INCREMENT,
// `username` varchar(50) NOT NULL,
// `password` varchar(50) NOT NULL,
// PRIMARY KEY (`id`),
// KEY `username` (`username`)
// ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
// INSERT INTO `users` (`username`, `password`) VALUES