Skip to content

Instantly share code, notes, and snippets.

item= { type: 'node',
id: 26544677,
lat: 31.214043300000004,
lon: 29.8856965,
tags:
{ name: 'ﻢﻧﺍﺭﺓ ﺍﻺﺴﻜﻧﺩﺮﻳﺓ',
'name:en': 'Lighthouse of Alexandria',
tourism: 'attraction',
wikidata: 'Q43244',
wikipedia: 'en:Lighthouse of Alexandria' },
@mk30
mk30 / decode-file.js
Created November 5, 2020 05:01
georender-pack examples for files
var xhr = require('xhr')
var decode = require('../decode.js')
var buffers = []
xhr.get('./alexbufarr', function(err, resp) { //input filename is hardcoded here
resp.body.split('\n').forEach(function(line){
if (line.length != 0){
buffers.push(Buffer.from(line, 'base64'))
}
else return
@mk30
mk30 / gist:3fe1bf103da3d7828621b8c7413e6e8c
Last active June 9, 2017 08:59
installing node.js 2
find the appropriate file for your system on https://nodejs.org/en/download/
(if you're not sure whether you should use 32-bit or 64-bit, follow instructions here: https://www.computerhope.com/issues/ch001121.htm)
copy the link to the appropriate file. in the example below we're using the link for the Linux 64-bit binary. if you're using a different file, substitute as necessary.
on the command line, do the following series of commands one at a time:
cd /tmp
wget https://nodejs.org/dist/v6.10.3/node-v6.10.3-linux-x64.tar.xz
tar -xf node-v6.10.3-linux-x64.tar.xz
download appropriate file from https://nodejs.org/en/download/
`tar -xf /name/of/file.tar.gz -C /usr/local/`
`export PATH=$PATH:node_dir/bin`
if in ubuntu: `sudo ln -s "$(which nodejs)" /usr/bin/node`
function colors (onclick) {
var pkeys = Object.keys(state.paletteMap)
var prows = []
for (var i = 0; i < pkeys.length; i += 10) {
prows.push(pkeys.slice(i,i+10))
}
return html`<div class="colors">
${prows.map(function (row) {
return html`<div>
${row.map(function (src) {
if (prows) {
var phex = pals[state.palette].hex
for (var i = 0; i < phex.length; i += 10) {
prows.push(phex.slice(i,i+10))
}
}
const regl = require('regl')()
const vectorizeText = require('vectorize-text')
const mat4 = require('gl-mat4')
const glsl = require('glslify')
const textMesh = vectorizeText('thank you pauline oliveros', {
triangles: true,
width: 5,
textAlign: 'center',
textBaseline: 'middle'
})
module.exports = function (regl){
const drawcyl = regl({
frag: `
precision mediump float;
varying vec3 vnormal;
vec3 hsl2rgb(vec3 hsl) {
vec3 rgb = clamp( abs(mod(hsl.x*5.0+vec3(0.0,4.0,2.0),6.0)-3.0)-1.0, 0.0, 1.0 );
return hsl.z - hsl.y * (rgb-0.5)*(3.0-abs(2.0*hsl.y-1.0));
}
void main () {
var mesh = isosurface.surfaceNets([26,26,26],
function sdTorus(a, b) //a should be a vec3, b should be a vec2
{
c = [glvec2.length([a[0], a[2]])-b[0],a[1]];
return glvec2.length(c)-a[1];
}, [[-11,-11,-11], [11,11,11]])
marina@lilserve:~$ top
top - 18:05:25 up 40 days, 14:29, 1 user, load average: 0.02, 0.27, 0.21
Tasks: 78 total, 1 running, 77 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem: 501792 total, 487360 used, 14432 free, 5188 buffers
KiB Swap: 1048572 total, 40 used, 1048532 free. 78992 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2340 marina 20 0 24816 1520 1112 R 0.3 0.3 0:00.03 top