Skip to content

Instantly share code, notes, and snippets.

View frank-dspeed's full-sized avatar
🇩🇪
I Engineer

Frank Lemanschik frank-dspeed

🇩🇪
I Engineer
View GitHub Profile
@frank-dspeed
frank-dspeed / socket.io-stream-server-to-browser.js
Created February 14, 2018 14:25 — forked from companje/socket.io-stream-server-to-browser.js
socket.io-stream from NodeJS Server to Browser
/////////////////////////////
// NodeJS Server
/////////////////////////////
var express = require('express');
var app = express();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var ss = require('socket.io-stream');
var path = require('path');
@frank-dspeed
frank-dspeed / package-json-engines.md
Created February 16, 2018 14:06 — forked from jareware/package-json-engines.md
Enforcing the engines property of package.json

Document your target environment with:

"engines": {
  "npm": ">=3.3.12 <4",
  "node": ">=5.5.0 <6"
},

Then install this:

"devDependencies": {

@frank-dspeed
frank-dspeed / can-defer.js
Last active March 12, 2018 11:50 — forked from andrejewski/can-defer.js
Declaratively defer rendering for large components and lists (Can v4)
import Component from 'can/component/';
export default Component.extend('CanDeferComponent', {
tag: 'can-defer',
viewModel: {
delayMs: {
type: 'number',
default: 0,
set: x => parseInt(x, 10)
},
@frank-dspeed
frank-dspeed / update-your-mustache.js
Created September 29, 2018 07:53 — forked from devinrhode2/update-your-mustache.js
Why not hookup mustache templates to auto-update?
/* by Devin Rhode (@Devinrhode2)
Mustache templates are a one-time operation.
I realized this doesn't have a to be, and having them auto-update is *extremely trivial*
So, we have this mustache:
<p>Hello, {{username}}</p>
@frank-dspeed
frank-dspeed / destructuring.js
Created October 28, 2018 05:37 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];

ServiceWorker for github pages

This is a ServiceWorker template to turn small github pages into offline ready app.

Why ?

Whenever I make small tools & toys, I create github repo and make a demo page using github pages (like this one).
Often these "apps" are just an index.html file with all the nessesary CSS and JavaScript in it (or maybe 2-3 html/css/js files). I wanted to cache these files so that I can access my tools offline as well.

Notes

Make sure your github pages have HTTPS enforced, you can check Settings > GitHub Pages > Enforce HTTPS of your repository.

@frank-dspeed
frank-dspeed / stripdown-debian.sh
Created December 18, 2018 13:18 — forked from dcloud9/stripdown-debian.sh
How-to Strip Down Debian Distro
#! /bin/bash
# Should be run on a vanilla Debian install.
# This script will strip it down to bare minimum and yet bootable distro.
# Simulated run onlyi (--simulate). Uncomment this and Comment out the "Real Deal".
#apt-get --simulate purge $(dpkg-query -Wf '${Package;-40}${Essential}${Priority}\n'|awk '$2 ~ /nooptional|noextra/ {print $1}'|grep -v -E 'anacron|busybox|initramfs-tools|insserv|klibc-utils|libklibc|libsemanage-common|libsemanage1|libustr-1.0-1|libuuid-perl|linux-base|linux-image')
# Real deal.
apt-get purge $(dpkg-query -Wf '${Package;-40}${Essential}${Priority}\n'|awk '$2 ~ /nooptional|noextra/ {print $1}'|grep -v -E 'anacron|busybox|initramfs-tools|insserv|klibc-utils|libklibc|libsemanage-common|libsemanage1|libustr-1.0-1|libuuid-perl|linux-base|linux-image')
@frank-dspeed
frank-dspeed / rollup.config.js
Last active December 31, 2018 01:30 — forked from garima33/rollup-config.js
iife rollup
// this is the rollup plugin that adds babel as a compilation stage.
import babel from 'rollup-plugin-babel';
//Convert CommonJS modules to ES6,
// so they can be included in a Rollup bundle
import commonjs from 'rollup-plugin-commonjs';
// Locate modules using the Node resolution algorithm,
// for using third party modules in node_modules
import nodeResolve from 'rollup-plugin-node-resolve';
@frank-dspeed
frank-dspeed / DNSMasq_withMalwareBlocking.md
Created January 22, 2019 19:29 — forked from erlepereira/DNSMasq_withMalwareBlocking.md
Using DNSMasq as a caching nameserver & add in a malware etc blocking

Assuming a Properly configured DNSMasq

a quickstart for dnsmasq is given at the end if you have not set it up yet.

something like this will add a great regularly updated malware file for it to use. More security and privacy to you! Specifically, this uses https://github.com/StevenBlack/hosts Choose one of the Raw Hosts file from there to use.

To setup DNSMasq, follow the below ...

wget -O- https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | awk '$1 == "0.0.0.0" { print "address=/"$2"/0.0.0.0/"}' > /etc/dnsmasq.d/malware.conf`
@frank-dspeed
frank-dspeed / 2018-https-localhost.md
Last active February 4, 2025 17:41 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

Create a own domain (1-10 Domains No Wildcards)

edit /etc/hosts add my.