This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const scaleNeeded = ( | |
src: { w: number; h: number }, | |
trgt: { w: number; h: number }, | |
): number => { | |
const wr = trgt.w / src.w; | |
const hr = trgt.h / src.h; | |
return Math.min(wr,hr); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java -Duser.timezone=UTC -jar logseq.jar | |
21-01-19 11:23:30 pop-os INFO [org.eclipse.jetty.util.log:169] - Logging initialized @5544ms to org.eclipse.jetty.util.log.Slf4jLog | |
Server is running on port 3000 ! | |
21-01-19 11:23:30 pop-os INFO [com.zaxxer.hikari.HikariDataSource:80] - logseq-clj-db-pool - Starting... | |
Exception in thread "main" clojure.lang.ExceptionInfo: Error in component :hikari in system com.stuartsierra.component.SystemMap calling #'com.stuartsierra.component/start {:reason :com.stuartsierra.component/component-function-threw-exception, :function #'com.stuartsierra.component/start, :system-key :hikari, :component #app.components.hikari.Hikari{:db-spec {:database-name "logseq", :adapter "postgresql", :auto-commit true, :register-mbeans false, :password nil, :port-number 5432, :username nil, :max-lifetime 1800000, :minimum-idle 10, :connection-init-sql "set time zone 'UTC'", :connection-timeout 30000, :server-name "localhost", :read-only false, :maximum-pool-size 48, :idle-timeout 600000, :valida |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Hypercore = require('hypercore'); | |
const ram = require('random-access-memory'); | |
const crypto = require('hypercore-crypto'); | |
(async () => { | |
const keyPair = crypto.keyPair(); | |
const a = new Hypercore(ram, { keyPair }); | |
const b = new Hypercore(ram, a.key, { keyPair: keyPair }); | |
await a.append(['a1', 'a2']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm i hypercore@next hyperswarm@next random-access-memory | |
// Run `node resolve-hypercore.js <key you get from https://gist.github.com/Nazeh/60291b111f93928d8110ff0ae9ecea25> | |
const Hypercore = require('hypercore'); | |
const Hyperswarm = require('hyperswarm'); | |
const ram = require('random-access-memory'); | |
const resolveCore = async (key) => { | |
const core = new Hypercore(ram, key, { valueEncoding: 'json' }); | |
await core.ready(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm i [email protected] [email protected] | |
// Run `node create-hypercore.js` and pass the resulting key to https://gist.github.com/Nazeh/721368b93729dcfa00049c9de230f2ad | |
const Hypercore = require('hypercore'); | |
const Hyperswarm = require('hyperswarm'); | |
const createCore = async () => { | |
const core = new Hypercore('origin', { valueEncoding: 'json' }); | |
await core.ready(); | |
// Add blocks here if you want. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { SDK } from '@synonymdev/slashtags-sdk'; | |
const sdkA = await SDK.init({ | |
persist: false, // No storage needed for this demo | |
primaryKey: Buffer.from('a'.repeat(64)), // Keep primary key consistent | |
}); | |
console.log("Alice's DHT bootstrapped"); // Bootstrapping DHT takes some time. | |
const alice = sdkA.slashtag({ name: 'alice' }); | |
alice.listen(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Hypercore from 'hypercore'; | |
import Hyperbee from 'hyperbee'; | |
class Hyperstate extends Hypercore { | |
constructor(storage, key, opts) { | |
super(storage, key, opts); | |
this.state = {}; | |
this.opening = this._open(); | |
this.opening.catch(noop); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Hyperswarm from 'hyperswarm' | |
import Corestore from 'corestore' | |
import ProtomuxRPC from 'protomux-rpc' | |
import RAM from 'random-access-memory' | |
import createTestnet from '@hyperswarm/testnet' | |
const testnet = await createTestnet() | |
const swarm_A = new Hyperswarm(testnet) | |
const store_A = new Corestore(RAM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Hyperswarm from 'hyperswarm' | |
import Corestore from 'corestore' | |
import ProtomuxRPC from 'protomux-rpc' | |
import Protomux from 'protomux' | |
import RAM from 'random-access-memory' | |
import createTestnet from '@hyperswarm/testnet' | |
import Hypercore from 'hypercore' | |
const testnet = await createTestnet() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as SlashURL from '@synonymdev/slashtags-url' | |
import Corestore from 'corestore' | |
import Hyperdrive from 'hyperdrive' | |
import Hyperswarm from 'hyperswarm' | |
import RAM from 'random-access-memory' | |
const swarm = new Hyperswarm() | |
const corestore = new Corestore(RAM) | |
swarm.on('connection', socket => corestore.replicate(socket)) |
OlderNewer