Skip to content

Instantly share code, notes, and snippets.

View melvincarvalho's full-sized avatar
💭
I may be slow to respond.

Melvin Carvalho melvincarvalho

💭
I may be slow to respond.
View GitHub Profile
@melvincarvalho
melvincarvalho / publickey.js
Last active August 29, 2015 14:26
convert openssh id_rsa.pub to modulus and exponent
#!/usr/bin/env node
// requires
var forge = require('node-forge');
var fs = require("fs");
// init
var sshpubkey = {};
var pubkey;
@melvincarvalho
melvincarvalho / generatex509.js
Last active September 23, 2018 23:30
create x.509 certificate and sign in javascript
var fs = require("fs");
var forge = require('node-forge');
console.log('Generating 1024-bit key-pair...');
var keys = forge.pki.rsa.generateKeyPair(1024);
console.log('Key-pair created.');
console.log('Creating self-signed certificate...');
var cert = forge.pki.createCertificate();
cert.publicKey = keys.publicKey;
@melvincarvalho
melvincarvalho / openssh.js
Last active August 29, 2015 14:26
covert id_rsa and id_rsa.pub to x509 pem in javascript
var fs = require("fs");
var forge = require('node-forge');
var login = 'melvincarvalho';
var pubkeyfile;
var privkeyfile;
var pemfile;
// command line arguments
<https://melvincarvalho.com/#me> <http://xmlns.com/foaf/0.1/account> <https://github.com/melvincarvalho> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
<#wallet>
<http://purl.org/dc/terms/description> "Klaranet Main" ;
a <https://w3id.org/cc#Wallet> ;
<http://www.w3.org/2006/vcard/ns#hasSound> "https://raw.githubusercontent.com/schildbach/bitcoin-wallet/master/wallet/res/raw/coins_received.wav" ;
<https://w3id.org/cc#api> <http://klaranet.com/wallet/main/api/v1/> ;
<https://w3id.org/cc#inbox> <inbox/> ;
<https://w3id.org/cc#tx> <tx/> .
@melvincarvalho
melvincarvalho / sign.js
Created August 3, 2015 17:46
sign a nonce
#!/usr/bin/env node
var forge = require('node-forge');
var sshprivkey = require('./sshprivkey.js');
var sshpubkey = require('./sshpubkey.js');
sshprivkey('./id_rsa.1', function(err, ret) {
if(err) {
console.error(err);
@melvincarvalho
melvincarvalho / coc.md
Last active August 29, 2015 14:26
coc

Community

Gitpay is about creating value for one another: in our work, we try to capture the spirit of being human. We believe that if we strive to serve each other well, our own success will follow.

We want a productive, happy and agile community that can welcome new ideas in a complex field, improve every process every year, and foster collaboration between groups with very different needs, interests and skills.

We gain strength from diversity, and actively seek participation from those who enhance it. This code of conduct exists to ensure that diverse groups collaborate to mutual advantage and enjoyment. We will challenge prejudice that could jeopardise the participation of any person in the project.

The Code of Conduct governs how we behave in public or in private whenever the project will be judged by our actions. We expect it to be honoured by everyone who represents the project officially or informally, claims affiliation with the project, or participates directly.

@melvincarvalho
melvincarvalho / discovery.md
Last active September 25, 2015 10:09
SoLiD Discovery

SoLiD Discovery (Draft)

The following describes discovery in the SoLiD framework using HTTP link following aka "follow your nose".

Starting point -- WebID

The starting point of SoLiD discovery is a WebID user profile, which is a hash based URI, typically denoting a (FOAF) Agent. From this profile all of your storage can be found (discovery).

Storage Discovery

@melvincarvalho
melvincarvalho / publickey.ttl
Created October 2, 2015 17:58
publickey.ttl
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix api: <tag:graph.facebook.com,2011:/> .
@prefix og: <http://ogp.me/ns#> .
@prefix fb: <http://ogp.me/ns/fb#> .
@prefix : <https://graph.facebook.com/schema/~/> .
@prefix invalidid: <https://graph.facebook.com/schema/invalidid#> .
@melvincarvalho
melvincarvalho / inboxnotes.txt
Last active October 27, 2015 10:21
inbox notes
<bigbluehat> deiu: this stuff is relatively new
<bigbluehat> ...so it's not ready to be normative
<bigbluehat> ...we want to build a system that folds into how LDP works
<bigbluehat> ...you can have notifications inboxes
<bigbluehat> ...inboxes are just a container--into which clients post notifications
<bigbluehat> ...each inbox can contain as much data as you want
<bigbluehat> ...clients will then interpret the contents and take what they need from inside
<bigbluehat> ...it's not limited to just source & target
<bigbluehat> ...you can have a lot more metadata about the notification
<bigbluehat> ...you can also have secure notifications