Skip to content

Instantly share code, notes, and snippets.

View dapangmao's full-sized avatar
🏠
Working from home

Dapangmao dapangmao

🏠
Working from home
View GitHub Profile
@dapangmao
dapangmao / index.js
Created February 8, 2016 14:26
chapter 1
var mongodb = require('mongodb');
var uri = 'mongodb://localhost:27017/example';
mongodb.MongoClient.connect(uri, function(error, db) {
if (error) {
console.log(error);
process.exit(1);
}
db.collection('sample').insert({ x: 1 }, function(error, result) {
  1. curl vs wget
  • 以前还真没注意他们的差别
  1. Performance & Usage at Instagram
  • 答案是educed the maximum number of summary comments.
  • 他们真用python吗?
  1. 排队论在架构的应用:对服务延迟、稳定性的影响
  • timeout从poisson distribution
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
import datetime
import time
import mpld3
import matplotlib.pylab as pylab
pylab.rcParams['figure.figsize'] = 12, 5 # that's default image size for this interactive
def create_plot():
  1. 程序员如何优雅的挣零花钱?
  • 难啊
  • 有点意思
- 在行 http://www.zaih.com : 这个是果壳旗下的,做得比较早,内容是全行业的,所以上边技术向的反而不多。

- 缘创派 http://q.ycpai.com/h5/lightPartner/expertList : 缘创派的轻合伙栏目,主要面向创业者,适合喜欢感受创业氛围的技术专家们。

- 极牛  http://geekniu.com  : 你可以认为这是一个程序员版本的「在行」,我浏览了下,虽然被约次数比在行要低不少,但专业性比较强,期望他们能尽快的推广开来吧。
  1. Dark traffic 是什么
  • 或者head, 或者get url

Context

  • To developing the application, we will constantly query the QA database running on the LOCTEST server.
  • The queries that are under testing are usually very complicated. The waiting time with the server ranges from seconds to 20 minutes or even longer.
  • The LOGTEST server may be down or gets extremely slower occasionally .
  • The database qa1_loctest_inventory is mostly used. The article here introduces how to copy the invertory database to a local Mac environment

The procedures

1. Dump file from LOCTEST

set nocompatible " required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'tmhedberg/SimpylFold'
Plugin 'vim-scripts/indentpython.vim'
-- https://postgrest.com/en/v0.4/auth.html#sql-user-management
create schema if not exists basic_auth;
create table if not exists
basic_auth.users (
email text primary key check ( email ~* '^.+@.+\..+$' ),
pass text not null check (length(pass) < 512),
role name not null check (length(role) < 512)
CREATE OR REPLACE FUNCTION public.login(email text, pass text)
RETURNS basic_auth.jwt_token
LANGUAGE plpgsql
AS $function$
declare
_role name;
result basic_auth.jwt_token;
begin
-- check email and password
select basic_auth.user_role(email, pass) into _role;