在这篇短文中,我们记录了如何在使用 [Ubuntu][] 1804 LTS
操作系统的单台服务器上,建立用户隔离的 [JupyterLab][] Web 环境。
目标是:
- 操作系统的用户可以各自不受干扰的使用独立的 [JupyterLab][]
- 各个用户的 [Conda][] 环境可以自动的出现在 [JupyterLab][] 的
Kernel
列表中
#!/usr/bin/env ruby | |
require 'open3' | |
def branch_exists?(branch_name) | |
o, s = Open3.capture2("git rev-parse --verify #{branch_name}") | |
s.success? | |
end | |
def write_credentials_to_file(credentials_path, key_path, target_path) |
- a 形容词 | |
- ad 副形词 | |
- ag 形容词性语素 | |
- an 名形词 | |
- b 区别词 | |
- c 连词 | |
- d 副词 | |
- df | |
- dg 副语素 | |
- e 叹词 |
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
// Suggestions from golang-nuts | |
// http://play.golang.org/p/Ctg3_AQisl |
sudo apt-get install build-essential tcl
cd /tmp
curl -O http://download.redis.io/redis-stable.tar.gz
tar xzvf redis-stable.tar.gz
# Yay! High voltage and arrows! | |
prompt_setup_pygmalion(){ | |
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_CLEAN="" | |
base_prompt='%{$fg[yellow]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}' | |
post_prompt='%{$reset_color%}%{$fg[red]%}❯%{$reset_color%}%{$fg[yellow]%}❯%{$reset_color%}%{$fg[green]%}❯%{$reset_color%}%b ' |
require 'active_record/relation.rb' | |
module ActiveRecord | |
# = Active Record \Relation | |
class Relation | |
private | |
def exec_queries(&block) | |
# 如果没有排序且没有 select 任何字段 添加默认主键排序 | |
order(arel_attribute(primary_key)) if order_values.empty? && select_values.empty? |
# postgre 实现 partition | |
CREATE TABLE measurement ( | |
id int not null PRIMARY KEY, | |
logdate date not null, | |
peaktemp int, | |
unitsales int | |
); | |
CREATE TABLE measurement_y2006 ( ) INHERITS (measurement); | |
CREATE TABLE measurement_y2005 ( ) INHERITS (measurement); |
class CoordConvert | |
class << self | |
PI = 3.14159265358979324 | |
X_PI = PI * 3000.0 / 180.0 #圆周率转换量 | |
## Krasovsky 1940 | |
## a = 6378245.0, 1/f = 298.3 | |
## b = a * (1 - f) | |
## ee = (a^2 - b^2) / a^2 | |
A = 6378245.0 #椭球体的长半轴半径 | |
EE = 0.00669342162296594323 #椭球体的第一偏心率 |