- Create a k8s cluster https://cloud.digitalocean.com/kubernetes/clusters
- Install kubectl https://kubernetes.io/docs/tasks/tools/install-kubectl/
- Download config file from cluster page to
~/.kube/config
I wanted to replace rsync for my current host backups.
I had 2 hosts (1 laptop and 1 desktop) that would get there changes polled from a backup server. (polled = cronjob ran every hours) Ofcourse those boxes are not always on and a frenzy of cron mails happen every now and then.
I replaced everything with syncthing, they have clients available for linux, illumos, openbsd and mac. With the config below (client::folder master = yes, server::folder master = no) we prevent the server from accidentally overriding a file on the client. The client knows the server's IPv4 and/or IPv6 address so we do not need global or local discovery nor UPnP.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isAnimatedGif(src, cb) { | |
var request = new XMLHttpRequest(); | |
request.open('GET', src, true); | |
request.responseType = 'arraybuffer'; | |
request.addEventListener('load', function () { | |
var arr = new Uint8Array(request.response), | |
i, len, length = arr.length, frames = 0; | |
// make sure it's a gif (GIF8) | |
if (arr[0] !== 0x47 || arr[1] !== 0x49 || |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stolen from http://paste.pocoo.org/show/224441/ | |
from pymongo.cursor import Cursor | |
from pymongo.connection import Connection | |
from pymongo.errors import AutoReconnect | |
from time import sleep | |
def reconnect(f): | |
def f_retry(*args, **kwargs): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/pymongo/connection.py b/pymongo/connection.py | |
index b444f50..7635c78 100644 | |
--- a/pymongo/connection.py | |
+++ b/pymongo/connection.py | |
@@ -46,6 +46,7 @@ from pymongo import (database, | |
helpers, | |
message) | |
from pymongo.cursor_manager import CursorManager | |
+from pymongo.decorators import reconnect | |
from pymongo.errors import (AutoReconnect, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="zh-CN"> | |
<head> | |
<title>Triangle</title> | |
<meta charset="utf-8" /> | |
<style type="text/css"> | |
.a{width:0;height:0;border-top:100px solid #0099ff;border-left:100px solid #ff9900;border-right:100px solid #F6402D;border-bottom:100px solid #8CC63E; float:left;} | |
.b{ | |
width:0;height:0;border-top:100px solid #0099ff;border-left:100px solid transparent;border-right:100px solid transparent;border-bottom:0; margin-left:60px; float:left;} | |
.c{width:0;height:0;border-top:100px solid transparent;border-left:0;border-right:100px solid transparent;border-bottom:100px solid #0099ff; margin-left:60px; float:left;} |