Skip to content

Instantly share code, notes, and snippets.

View MichelDiz's full-sized avatar
🎼
If I die before I wake, pray the lord my soul to take.

Michel Diz MichelDiz

🎼
If I die before I wake, pray the lord my soul to take.
View GitHub Profile

Keybase proof

I hereby claim:

  • I am micheldiz on github.
  • I am micheldiz (https://keybase.io/micheldiz) on keybase.
  • I have a public key ASBjU3iHeA4_FpHGHorzXcFzmx9aExSv93oxLkvXVqg4MQo

To claim this, I am signing this object:

@MichelDiz
MichelDiz / sql.js
Last active November 20, 2017 14:56
This is an example code of how the apollo-universal-starter-kit would work using Dgraph. A powerful graph database, fast, has clustering ability, created in GoLang and so on. In this example I'm using a client that uses gRPC to communicate with Dgraph. See docs https://docs.dgraph.io/
// Helpers
//import { camelizeKeys, decamelizeKeys, decamelize } from 'humps';
import { has } from 'lodash';
import bcrypt from 'bcryptjs';
import DgraphClient from 'dgraph-node';
// Create a new client
let client = new DgraphClient({
url: 'localhost:9080',
debug: false
async registerDgraph({ username, email, password, role, isActive }) {
// const passwordHashed = await bcrypt.hash(password, 12);
console.log(username, '<====== username');
const txn = dgraph.newTxn();
try {
if (role === undefined) {
role = 'user';
}
const now = new Date().toISOString();
let mu = new dgraph.Mutation();
{
"set": [ {
"user": [
{
"uid": "_:michael",
"name": "Michael",
"age": 39,
"Posts": [
{
"uid": "_:michaelfirst",
{
set {
#We create the groups as nodes
_:group_year <name> "1979" .
_:group_year <release_date> "1979-01-01" .
_:group_year2 <name> "1950" .
_:group_year2 <release_date> "1950-01-01" .
{
GetIssues_Customer_By_metaTags(func: eq(title, "Hyper Tech")) # @cascade @normalize
{
uid
issues @filter(eq(metaTags, ["Urgent","Bug"]))# AND NOT eq(metaCategories, "Problem"))
{
title
metaTags
metaCategories
participants {
@MichelDiz
MichelDiz / dgraph-1.1.0-rc3-test.go
Last active August 29, 2019 01:08 — forked from bgv/dgraph-1.1.0-rc3-test.go
dgraph-1.1.0-rc3-test.go
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"github.com/dgraph-io/dgo/v2"
"github.com/dgraph-io/dgo/v2/protos/api"
@MichelDiz
MichelDiz / Enable-DockerRemoteAPI.md
Created September 15, 2019 19:01 — forked from CollinChaffin/Enable-DockerRemoteAPI.md
Enable Docker Remote API on Photon OS v3(+)

Enable Local/Remote Docker API on PhotonOS

Prerequisites

You must have already performed the following in one form or another as well as properly set a STATIC IP. Bear in mind many instructions do not properly show how to commit iptables changes on Photon which then survive reboots.

iptables -A INPUT -p tcp --dport 2375 -j ACCEPT
iptables -A INPUT -p tcp --dport 2376 -j ACCEPT
iptables-save > /etc/systemd/scripts/ip4save
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"github.com/dgraph-io/dgo/v2"
"github.com/dgraph-io/dgo/v2/protos/api"
upsert {
query {
getVals(func: has(products)) {
productsUid as uid
products @filter(eq(productId, 19610626)) {
productUid as uid
options @filter(eq(optionId, 32661491)) {
optionUid as uid
}
}