Skip to content

Instantly share code, notes, and snippets.

@Hadryan
Hadryan / AesStringEncryptor.java
Created May 21, 2021 12:06 — forked from thiamteck/AesStringEncryptor.java
OpenSSL equivalent for AES encryption with and without PBKDF2 and key-obtention iteration (-iter)
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;
@Hadryan
Hadryan / Crypto.scala
Created May 21, 2021 11:52 — forked from mardambey/Crypto.scala
AES/PKCS5 - encrypted with Perl::CBC and decrypted in Scala/Java
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 {
@Hadryan
Hadryan / EncryptionUtil.java
Created May 20, 2021 09:54 — forked from utkarshgpta/EncryptionUtil.java
IPFS and Encrption Utility Files
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;
== 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
@Hadryan
Hadryan / TikTok Dictionary
Last active January 29, 2021 19:56 — forked from davidteather/TikTok Dictionary
This is an example of a TikTok dictionary returned by davidteather/TikTok-Api
{
'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',
@Hadryan
Hadryan / graphql-fetch.js
Created January 26, 2021 08:21 — forked from loicplaire/graphql-fetch.js
GraphQL + Fetch
require("isomorphic-fetch");
const query = JSON.stringify({
query: `mutation {
createChallenge(
data: {
title: "Nono"
isPublished: true
duration: 300
sequence: {
@Hadryan
Hadryan / updateCountry_fetch.js
Created January 25, 2021 10:05 — forked from yusinto/updateCountry_fetch.js
Graphql mutation with fetch
const updateCountryFetch = async (countryId, happinessFactor, population) => {
const query = JSON.stringify({
query: `mutation {
updateCountry(
id: "${countryId}"
happinessFactor: ${happinessFactor}
population: ${population}) { id }
}
`
});
@Hadryan
Hadryan / express_with_jwt.js
Created January 20, 2021 13:21 — forked from thebigredgeek/express_with_jwt.js
Express API with JWT
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;
@Hadryan
Hadryan / encryption.js
Created January 19, 2021 15:16 — forked from Tiriel/encryption.js
Symetric encryption/decryption for PHP and NodeJS communication
'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) {
@Hadryan
Hadryan / rabbitmq.txt
Created January 18, 2021 12:47 — forked from sdieunidou/rabbitmq.txt
create admin user on rabbitmq
rabbitmqctl add_user test test
rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"