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.
Picking the right architecture = Picking the right battles + Managing trade-offs
- Clarify and agree on the scope of the system
- User cases (description of sequences of events that, taken together, lead to a system doing something useful)
- Who is going to use it?
- How are they going to use it?
As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.
| package utils | |
| import ( | |
| "runtime" | |
| "github.com/Sirupsen/logrus" | |
| ) | |
| // DecorateRuntimeContext appends line, file and function context to the logger | |
| func DecorateRuntimeContext(logger *logrus.Entry) *logrus.Entry { |
| Summary | How to control (or Understand) your GIST page's files list order. |
| Notice | not official documentation. |
| #!/usr/bin/python | |
| import os | |
| import errno | |
| import sqlite3 | |
| import sys | |
| from time import time | |
| from cPickle import loads, dumps | |
| import logging |
I've put together these notes as I read about DHT's in depth and then learned how the libtorrent implementation based on the Kademlia paper actually works.
400,000,000,000 (400 billion stars), that's a 4 followed by 11 zeros.
The number of atoms in the universe is estimated to be around 10^82.
A DHT with keys of 160 bits, can have 2^160 possible numbers, which is around 10^48
| [alias] | |
| recent = "!git for-each-ref --sort=-committerdate refs/heads/ --format='%(committerdate:short) %(refname:short)' | head -n 10" | |
| co = checkout | |
| cob = checkout -b | |
| coo = !git fetch && git checkout | |
| br = branch | |
| brd = branch -d | |
| brD = branch -D | |
| merged = branch --merged | |
| st = status |
| #!/bin/bash | |
| function workspace_cd() { | |
| cd $@ && [ -f ".workspace" ] && source .workspace | |
| } | |
| alias cd="workspace_cd" |