Skip to content

Instantly share code, notes, and snippets.

View christroutner's full-sized avatar
💭
https://FullStack.cash is where I play.

Chris Troutner christroutner

💭
https://FullStack.cash is where I play.
View GitHub Profile
@christroutner
christroutner / OB-listing-prototype.html
Last active November 24, 2017 22:01
Using jQuery to create a new listing on OpenBazaar 2.0
<!DOCTYPE html>
<!--
Note: This is a proof of concept for creating a new listing on OpenBazaar 2.0 beta sever v0.10.0.
Based on this API guide:
https://api.openbazaar.org/
Documentation is pretty sparse in the OB repo right now, so this took a lot of hacking and reverse engineering.
For this example to work, you have to set up your config file. On linux, the config file is locted in ~/openbazaar2.0/
@christroutner
christroutner / oneName.md
Created November 2, 2017 04:50
OneName Gist
@christroutner
christroutner / docker-firewall.md
Last active January 24, 2018 22:35
Docker Firewall

This is an iptables script that should be copied to the /etc/iptables/rules.v4 file. This script is based on this blog entry. The goal is to setup a Docker container that is restricted from attacking the host.

The code below allows DNS to pass through, but blocks the Docker container from direct access to the 192.168.x.x subnet. It also enforces this same rule on the Host, in case it was to get hacked.

This script needs to be customized for each hardware target, as the name of the ethernet port will change. I also want to incorporate some ideas from this article:

  • Prevent DoS Attack
@christroutner
christroutner / config.md
Last active February 5, 2018 17:28
OpenBazaar BCH Config File

The file below is a very insecure, but easy, way to set up an OpenBazaar BCH store.

The reason it's insecure is because it turns on CORS and sets the login and password to yourUsername/yourPassword.

{
  "API": {
    "HTTPHeaders": null
  },
  "Addresses": {
@christroutner
christroutner / keybase.md
Created March 21, 2018 20:00
keybase.md

Keybase proof

I hereby claim:

  • I am christroutner on github.
  • I am christroutner (https://keybase.io/christroutner) on keybase.
  • I have a public key ASChDmOrWQCAjODenzwkjqFLU-qYn0-dRWOSNGpKS6C8zwo

To claim this, I am signing this object:

@christroutner
christroutner / output.js
Created April 13, 2018 22:46 — forked from derhuerst/output.js
how fetch a GitHub user's stars
[
{
owner: 'bcoe',
repo: 'top-npm-users',
description: ':star: Generate a list of top npm users by based on monthly downloads.',
language: 'JavaScript',
isFork: false,
stargazers: 27,
watchers: 27
}
@christroutner
christroutner / koa2-enable-CORS.md
Created April 27, 2018 18:10
koa2 Access-Control-Allow-Origin CORS example

It took me way too long and way too much trial and error to figure out how to turn on Cross Origin Resource Sharing (CORS) on my Koa 2 API. The problem is that there are too many ways and too many versions of all the pieces. It's not difficult if you follow the example below.

Note: You can download working code using this Koa 2 API Boilerplate repository.

The key insight that finally enabled me to success was this blog post, which used kcors library in favor of the koa-cors library.

@christroutner
christroutner / config
Created July 16, 2018 04:19
OpenBazaar BCH Config File 07-15-2018
{
"API": {
"HTTPHeaders": null
},
"Addresses": {
"API": "",
"Announce": null,
"Gateway": "/ip4/0.0.0.0/tcp/4002",
"NoAnnounce": null,
"Swarm": [
@christroutner
christroutner / dataRetrieval.js
Created August 28, 2018 00:04
Wormholecash Unit Test Template
/*
*/
"use strict";
console.log('hello world.');
@christroutner
christroutner / a-wormhole-unit-test-template.md
Last active August 28, 2018 00:39
Wormholecash Unit Test Template

This gist is an example of how unit tests could be written for the Wormholecash repo. The example below is taken from the balancesForAddress test in the dataRetrieval.js test file.

The original test looks like this:

// This is technically an 'integration' test because it makes a live HTTP call.
describe("#balancesForAddress", () =&gt; {