Skip to content

Instantly share code, notes, and snippets.

const { createWriteStream } = require('fs')
const hyperdrive = require('hyperdrive')
const raf = require('random-access-file')
const level = require('level')
const argv = require('minimist')(process.argv.slice(2))
const swarm = require('discovery-swarm')({
dns: {
server: [
'discovery1.publicbits.org',
'discovery2.publicbits.org'
@gerhardberger
gerhardberger / app.js
Last active November 5, 2016 12:27
protocol what
const { app, session, protocol, BrowserWindow } = require('electron')
app.on('ready', () => {
protocol.registerStringProtocol ('img', (request, callback) => {
let imgurl = request.url.replace(/img:\/\//i, '')
callback({
mimeType: 'text/html',
charset: 'utf-8',
data: `
<!DOCTYPE html>
const got = require('got')
const cheerio = require('cheerio')
const { writeFile } = require('fs')
let data = []
function fetch (year, month, cb) {
const url = `https://www.metnet.hu/?m=napi-adatok&sub=4&pid=6321&date=${
year}-${month < 10 ? '0' + month : month}-01`
got.get(url).then(res => {
#include "../cekla.h"
// helper function: length(l, len) => length of a list
int length (const list l, const int len) {
if (l == nil) return len;
return length(tl(l), len + 1);
}
// length(l) => length of a list
int length (const list l) {
@gerhardberger
gerhardberger / thing.md
Last active August 3, 2016 12:59
inspire

inspire

app

  • egy felulet ahol megfeleloen elrendezve grafokat lehet tarolni
  • a grafok csomopontjai URL-ek
  • az URL-eket tobbfele modon lehet lementeni:
    • egy dedicated gomb
    • beillesztes vagolaprol
  • drag n drop
@gerhardberger
gerhardberger / .hyperterm.js
Created July 15, 2016 19:48
tomorrow night eighties colors for hyperterm
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 13,
// font family with optional fallbacks
fontFamily: '"Droid Sans Mono", Menlo, monospace',
// terminal cursor background color (hex)
cursorColor: '#cccccc',
@gerhardberger
gerhardberger / index.js
Created June 3, 2016 20:29
requirebin sketch
"use strict"
var createCSS3D = require('gl-css3d');
var shell = require("gl-now")({clearColor: [0.2, 0.4, 0.8, 1.0]})
var camera = require("game-shell-orbit-camera")(shell)
var mat4 = require("gl-mat4")
var bunny = require("bunny")
var createMesh = require("gl-mesh")
var createSimpleShader = require("simple-3d-shader")
$ npm install
$ npm run native
$ npm run wrappers
$ npm test
// $ node --harmony_destructuring match.js -5
'use strict'
let x = Number(process.argv[2])
let { true: a } = {
[ x > 0 ]: 1,
[ x < 0 ]: -1,
[ x === 0 ]: 'wow'
}
# 1.3
iptables -A INPUT --source 10.0.2.0/24 --protocol tcp --dport 22 -j ACCEPT
iptables -A INPUT --source 127.0.0.0/8 --protocol tcp --dport 22 -j ACCEPT
iptables -A INPUT --protocol tcp --dport 22 -j DROP
# 1.4
iptables -A INPUT --protocol icmp -j DROP
# 1.5
sudo adduser gellert