Skip to content

Instantly share code, notes, and snippets.

View adamsoffer's full-sized avatar

Adam Soffer adamsoffer

View GitHub Profile
import React from 'react';
import PropTypes from 'prop-types';
import { useQuery } from 'react-apollo';
import GET_USER from './getUser.graphql';
const UserContext = React.createContext({});
export const UserProvider = props => {
const { loading, data } = useQuery(GET_USER);
const user = loading || !data.authUser ? null : data.user;
@levino
levino / scrypt+6.0.3.patch
Created September 7, 2018 14:32
Patch scrypt to load with webpack
diff --git a/node_modules/scrypt/index.js b/node_modules/scrypt/index.js
index 7b13a79..1e40d76 100644
--- a/node_modules/scrypt/index.js
+++ b/node_modules/scrypt/index.js
@@ -1,6 +1,6 @@
"use strict";
-var scryptNative = require("./build/Release/scrypt")
+var scryptNative = require("./build/Release/scrypt.node")
, Crypto = require("crypto")
@adamkl
adamkl / resolverChaining.ts
Last active October 19, 2021 12:46
An example of how to chain together local and remote GraphQL resolvers.
import {
fetchRemoteSchema,
authLink
} from "@private/graphql-proxy";
import { startGraphQLService } from "@private/graphql-scripts";
import { graphql, printSchema, print, parse } from "graphql";
import {
mergeSchemas,
makeRemoteExecutableSchema,
makeExecutableSchema
@miohtama
miohtama / geth-secure.md
Last active January 13, 2022 23:11
Secure RPC connections to geth daemon

Go Ethereum (geth) is a software for Ethereum. geth doesn't provide secure networking and it should do this, as this kind of built-in functionality would increase complexity and add attack surface to critical blockchain node software. Fortunately, in UNIX world, you can easily combine different tools to work together. The solution to this particular problem is to use VPN/tunneling software for secure connections. The tunnel will expose the server local connections to your own computer. The most popular tool for this (available in every OS by default, nowadays including Windows) is [Secure Shell (SSH)][1].

Note this question only addresses issues how to

[If you are not familiar with SSH please first read SSH tutorial how to safely do passwordless logins using SSH keys][2].

Start a node on server. When the node starts it binds its RPC port to localhost (127.0.0.1 in IPv4, ::1 in IPv6). This is so-called loopback connection that you can only access from the computer itself and not from external netwo

@adityamukho
adityamukho / User.js
Last active November 11, 2021 21:41
Passport authentication for Sails.js 0.9.x
/**
* api/models/User.js
*
* The user model contains the instance method for validating the password.
*/
var bcrypt = require('bcrypt');
function hashPassword(values, next) {
bcrypt.hash(values.password, 10, function(err, hash) {
@bemasher
bemasher / stack.go
Last active August 19, 2020 10:59
A simple LIFO stack backed by a linked list implemented with golang.
package main
import (
"fmt"
)
type Stack struct {
top *Element
size int
}