Skip to content

Instantly share code, notes, and snippets.

const DHT = require("@hyperswarm/dht");
var pump = require("pump");
var fs = require("fs");
const crypto = require("hypercore-crypto");
//const keyPair = crypto.keyPair();
(async () => {
const node = new DHT();
const keyPair = DHT.keyPair();
await node.ready();
const hash = crypto.data(Buffer.from("test", "utf-8"));
const DHT = require("@hyperswarm/dht");
const crypto = require('hypercore-crypto')
const node = new DHT({});
module.exports = (key='')=>{
return {
serve: (command, cb)=>{
const keyPair = crypto.keyPair(crypto.data(Buffer.from(key+command)));
const server = node.createServer();
server.on("connection", function(socket) {
'use strict'
const peerInfo = require('./lib/peer-info')
const peerQueue = require('./lib/queue')
const { EventEmitter } = require('events')
const network = require('@hyperswarm/network')
const MAX_SERVER_SOCKETS = Infinity
const MAX_CLIENT_SOCKETS = Infinity
const MAX_PEERS = 24
git clone https://github.com/Yahweasel/craig.git
cd craig
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
apt update
apt-get install -y ffmpeg vorbis-tools opus-tools libfdk-aac-dev zip unzip imagemagick php-imagick curl nodejs npm
cd cook
for i in *.c; do gcc -O3 -o ${i%.c} $i; done
for i in *.svg; do inkscape -e ${i%.svg}.png $i; done
npm install
sudo docker build --force-rm=true --tag="root/cloud9-docker:latest"
docker run -it -d -p 7999:80 -p 7998:3000 --link mongodb -v /store/files:/store/files -v /home/lanmower/dev/:/meteor/ -v /home/lanmower/workspace:/workspace root/cloud9-docker
docker run -it -d -p 7997:80 -p 7996:3000 --link mongodb -v /home/lanmower/hh:/workspace root/cloud9-docker
self.addEventListener('push', showNotification);
function showNotification(event) {
console.log('Received a push message', event);
event.waitUntil(
event.target.registration.pushManager.getSubscription().then(function(subscription) {
console.log(subscription);
subscription.subscriptionId = subscription.endpoint.split('https://android.googleapis.com/gcm/send/')[1];
#!/bin/bash
set -x
PATH="$HOME/bin:$PATH"
apt-get update && apt-get -y upgrade
apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev libgpac-dev \
libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libx11-dev \
libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev libmp3lame-dev wget checkinstall -y
@lanmower
lanmower / start.sh
Last active September 2, 2016 10:14
#!/bin/bash
APPNAME=<%= appName %>
APP_PATH=/opt/$APPNAME
BUNDLE_PATH=$APP_PATH/current
ENV_FILE=$APP_PATH/config/env.list
PORT=<%= port %>
# Remove previous version of the app, if exists
docker rm -f $APPNAME