Skip to content

Instantly share code, notes, and snippets.

View tolbkni's full-sized avatar
🎯
Focusing

Waters Gao tolbkni

🎯
Focusing
View GitHub Profile
@tolbkni
tolbkni / jupyter-notebook.service
Last active March 7, 2019 13:08
A systemd script for user to run a jupyter notebook as daemon.
# /etc/systemd/user/jupyter-notebook.service
[Unit]
Description=Jupyter Notebook Service
After=network.target
[Service]
ExecStart=/usr/bin/jupyter-notebook --config=%h/.jupyter/jupyter_notebook_config.py
[Install]
WantedBy=default.target
@tolbkni
tolbkni / memcached_expire_time_analytics.md
Created April 14, 2014 16:31
Memcached 过期时间分析

我们知道,缓存有其过期时间,具体到 memcached 中,我们来分析它是怎么处理过期时间的。

#define REALTIME_MAXDELTA 60*60*24*30

/*
* given time value that's either unix time or delta from current unix time, return
* unix time. Use the fact that delta can't exceed one month (and real time value can't
* be that low).
size extents ms ps
20G 5119 10 5109 chunk-size= 64k,10 chunk-size=4m, 2 8
100G 25599 50 25549 chunk-size= 64k,50 chunk-size=4m, 2 48
500G 127999 64 127935 chunk-size=256k,64 chunk-size=4m, 4 60
1T 262143 64 262079 chunk-size=512k,64 chunk-size=4m, 8 56
2T 524287 64 524223 chunk-size= 1m,64 chunk-size=4m,16 48
4T 1048574 64 1048510 chunk-size= 2m,64 chunk-size=4m,32 32
metaext = 160 > (vgext / 1000) ? 160 : vgext / 1000
poolext = vgext - metaext
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from flask import Flask
from flask import request, url_for, redirect
from werkzeug.utils import secure_filename
UPLOAD_DIR = "/tmp/uploads"
#!/bin/bash
PREFIX="/usr/local"
BIN_DIR="${PREFIX}/bin"
RBENV_DIR="${PREFIX}/rbenv"
RBENV_PLUGINS_DIR="${RBENV_DIR}/plugins"
RBENV_GROUP="rbenv"
# Install rbenv
pushd ${PREFIX}