This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.nio.charset.StandardCharsets; | |
| import java.security.InvalidAlgorithmParameterException; | |
| import java.security.InvalidKeyException; | |
| import java.security.MessageDigest; | |
| import java.security.NoSuchAlgorithmException; | |
| import java.security.SecureRandom; | |
| import java.security.spec.InvalidKeySpecException; | |
| import java.util.Arrays; | |
| import java.util.Base64; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import javax.crypto.spec.SecretKeySpec | |
| import javax.crypto.Cipher | |
| import javax.crypto.spec.IvParameterSpec | |
| import java.math.BigInteger | |
| import javax.crypto.SecretKeyFactory | |
| import java.security.MessageDigest | |
| import javax.xml.bind.DatatypeConverter._ | |
| object Crypto extends App { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package ipfs; | |
| import javax.crypto.*; | |
| import javax.crypto.spec.SecretKeySpec; | |
| import java.io.IOException; | |
| import java.nio.file.Files; | |
| import java.nio.file.Path; | |
| import java.nio.file.Paths; | |
| import java.security.*; | |
| import java.security.spec.InvalidKeySpecException; | |
| import java.security.spec.PKCS8EncodedKeySpec; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| == Northwind Graph | |
| === Introduction | |
| Recently, I was asked to pitch a method for providing recommendations. Luckily, armed with the knowledge obtained from talks from Max De Marzi and [Mark Needham](https://skillsmatter.com/skillscasts/7298-modelling-a-recommendation-engine-a-worked-example) at a recent Neo4j London Meetups, I knew this could be easily achieved with Neo4j. | |
| The key issue with recommendation engines comes from the data. Luckily, Neo4j comes bundled with the Northwind Graph Example. The Northwind database is an infamous dataset containing purchase history that has been used to teach relational databases for years and was a great place to start. You can import the Northwind database into a graph by following the ["Import Data into Neo4j"](http://neo4j.com/developer/guide-importing-data-and-etl/) post on Neo4j or type the following into Neo4j's browser at `http://localhost:7474/` | |
| :play northwind graph |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| 'id': '6818316025491246342', | |
| 'desc': 'My 2015 moves still play in 2020�😂 #quarantinelife #throwback', | |
| 'createTime': 1587512910, | |
| 'video': { | |
| 'height': 626, | |
| 'width': 470, | |
| 'duration': 11, | |
| 'ratio': '480p | |
| 'cover': 'https://p16.muscdn.com/obj/tos-maliva-p-0068/5951967888f341628c687b582f1970ac_1587512912', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require("isomorphic-fetch"); | |
| const query = JSON.stringify({ | |
| query: `mutation { | |
| createChallenge( | |
| data: { | |
| title: "Nono" | |
| isPublished: true | |
| duration: 300 | |
| sequence: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const updateCountryFetch = async (countryId, happinessFactor, population) => { | |
| const query = JSON.stringify({ | |
| query: `mutation { | |
| updateCountry( | |
| id: "${countryId}" | |
| happinessFactor: ${happinessFactor} | |
| population: ${population}) { id } | |
| } | |
| ` | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var express = require('express') | |
| , jwtMiddleware = require('express-jwt') | |
| , bodyParser = require('body-parser') | |
| , cookieParser = require('cookie-parser') | |
| , cors = require('cors'); | |
| // We pass a secret token into the NodeJS process via an environment variable. | |
| // We will use this token to sign cookies and JWTs | |
| var SECRET_TOKEN = process.env.SECRET_TOKEN; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| const crypto = require('crypto'); | |
| const AES_METHOD = 'aes-256-cbc'; | |
| const IV_LENGTH = 16; // For AES, this is always 16, checked with php | |
| const password = 'lbwyBzfgzUIvXZFShJuikaWvLJhIVq36'; // Must be 256 bytes (32 characters) | |
| function encrypt(text, password) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rabbitmqctl add_user test test | |
| rabbitmqctl set_user_tags test administrator | |
| rabbitmqctl set_permissions -p / test ".*" ".*" ".*" |