This file contains hidden or 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
import Queue | |
queue = Queue.Queue() | |
valueSet = set() | |
valueProc = [(lambda x: x/2+7, 1), (lambda x: (x+7)/2, 0), (lambda x: x*3-5, 3),(lambda x: (x-5)*3, 2)] | |
valueTry = [(lambda x: (x-5), 2), (lambda x: x*3, 3)] | |
def check(value, state): | |
for f, s in valueTry: | |
if not state == s: |
This file contains hidden or 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
def all_perm(l): | |
if not l: | |
return [[]] | |
return [[a] + b for a in l for b in all_perm(_remove(l, a))] | |
def _remove(l, item): | |
tmp = l[:] | |
tmp.remove(item) | |
return tmp |
This file contains hidden or 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
#define MAX_EVENTS 512 | |
#define LOCK_NAME ".server.lock" | |
#include <unistd.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <errno.h> | |
#include <signal.h> | |
#include <assert.h> |
This file contains hidden or 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
#define MAX_EVENTS 512 | |
#define LOCK_NAME ".server.lock" | |
#include <unistd.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <errno.h> | |
#include <signal.h> | |
#include <assert.h> |
This file contains hidden or 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
Show hidden characters
{ | |
// -------------------------------------------------------------------- | |
// JSHint Configuration, Strict Edition | |
// -------------------------------------------------------------------- | |
// | |
// This is a options template for [JSHint][1], using [JSHint example][2] | |
// and [Ory Band's example][3] as basis and setting config values to | |
// be most strict: | |
// | |
// * set all enforcing options to true |
This file contains hidden or 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
import functools | |
from multiprocessing import Process, Manager | |
def multiprocess_run(process_num): | |
def returning_wrapper(func, index, return_dict, *args, **kwargs): | |
return_dict['proc'+str(index)] = func(*args, **kwargs) | |
def wrap(f): | |
return_dict = Manager().dict() |
This file contains hidden or 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
# coding: utf-8 | |
import functools | |
import time | |
from threading import local | |
from collections import deque | |
class ATFieldException(Exception): | |
pass |
This file contains hidden or 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
{"info":{"version":"1.0.0","description":"\n## \u5173\u4e8e\u63a5\u53e3\u8c03\u7528\n\u63a5\u53e3\u901a\u8fc7 http \u534f\u8bae\u8c03\u7528\u3002\u6240\u6709\u63a5\u53e3\u7684 http method \u5168\u90e8\u4e3a POST\u3002\u6240\u6709\u63a5\u53e3\u7684 http \u72b6\u6001\u7801\u5168\u90e8\u4e3a 200\uff08\u662f\u5426\u8c03\u7528\u6210\u529f\u53c2\u8003\u8fd4\u56de\u7684\u4e1a\u52a1\u72b6\u6001\u7801\uff09\u3002\u6240\u6709\u63a5\u53e3\u7684\u4e1a\u52a1\u53c2\u6570\u5e8f\u5217\u5316\u4e3a json \u5b57\u7b26\u4e32\uff0c\u901a\u8fc7 http body \u4f20\u9012\u3002\u9274\u6743\u53c2\u6570\u901a\u8fc7 http header \u4f20\u9012\n## \u5173\u4e8e api \u7b7e\u540d\u9274\u6743\n\u5bf9\u4e8e\u6240\u6709\u7684\u63a5\u53e3\u8c03\u7528\uff0c\u8c03\u7528\u65b9\u90fd\u9700\u8981\u6dfb\u52a0\u7b7e\u540d\u53c2\u6570\u3002\u5e73\u53f0\u4f1a\u4e3a\u8c03\u7528\u65b9\u751f\u6210 apiKey \u548c apiSecret\n\u7b7e\u540d\u76f8\u5173\u6570\u636e\u901a\u8fc7 http header \u4f20\u9012\u3002http header key \u5206\u522b\u4e3a\uff1a\n- X-XCF-OPENAPI-KEY |
This file contains hidden or 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
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="white"; fi | |
PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%~/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) ' | |
RPROMPT='[%*]' | |
# git theming | |
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[yellow]%}%B" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[blue]%})%{$reset_color%} " | |
ZSH_THEME_GIT_PROMPT_CLEAN="" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}✗" |
This file contains hidden or 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
val existedDf = spark.sql("select 1 as a, '' as b, 1 as __row_key, 0 as __row_version") | |
val testTable = "foo" | |
val testConf = Map( | |
"hoodie.table.name" -> testTable, | |
"hoodie.avro.schema.validate" -> "true", | |
"hoodie.datasource.write.recordkey.field" -> "__row_key", | |
"hoodie.datasource.write.table.name" -> testTable, | |
"hoodie.datasource.write.precombine.field" -> "__row_version", |