Skip to content

Instantly share code, notes, and snippets.

View jcinis's full-sized avatar
BECOMING A SPHERE

Jessey White-Cinis jcinis

BECOMING A SPHERE
View GitHub Profile
@stepankuzmin
stepankuzmin / README.md
Created January 4, 2019 10:22
Gitlab AutoDevops on DigitalOcean k8s
@sjorge
sjorge / syncthing-backup.md
Last active July 31, 2023 14:16
using syncthing for backups

introduction

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.

@lakenen
lakenen / detectanimation.js
Created June 28, 2012 17:17
JavaScript animated GIF detection!
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 ||
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 23, 2024 18:01
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@aliang
aliang / gist:1393029
Created November 25, 2011 08:02
monkey patch to make pymongo not throw ridiculous AutoReconnect errors
# 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):
@mikeyk
mikeyk / reconnect.diff
Created June 30, 2011 21:05
Automatically retry on AutoReconnect exception in pymongo
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,
@aliang
aliang / triangles.html
Created June 20, 2011 09:21
triangles without images
<!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;}