Document your target environment with:
"engines": {
"npm": ">=3.3.12 <4",
"node": ">=5.5.0 <6"
},
Then install this:
"devDependencies": {
| ///////////////////////////// | |
| // 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'); |
Document your target environment with:
"engines": {
"npm": ">=3.3.12 <4",
"node": ">=5.5.0 <6"
},
Then install this:
"devDependencies": {
| import Component from 'can/component/'; | |
| export default Component.extend('CanDeferComponent', { | |
| tag: 'can-defer', | |
| viewModel: { | |
| delayMs: { | |
| type: 'number', | |
| default: 0, | |
| set: x => parseInt(x, 10) | |
| }, |
| /* 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> |
| // === Arrays | |
| var [a, b] = [1, 2]; | |
| console.log(a, b); | |
| //=> 1 2 | |
| // Use from functions, only select from pattern | |
| var foo = () => [1, 2, 3]; |
This is a ServiceWorker template to turn small github pages into offline ready app.
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.
Make sure your github pages have HTTPS enforced, you can check Settings > GitHub Pages > Enforce HTTPS of your repository.
| #! /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') |
| // 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'; |
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`
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).
edit /etc/hosts add my.