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
<script type="module"> | |
window.addEventListener('message', async(event) => { | |
if (event.origin.match(/jenkins.internal.sifive.com/)) return; | |
if (! event.origin.match(/^http:\/\/localhost:|internal.sifive.com/)) return; | |
const path = event.data; | |
const resp = await fetch(path); | |
const json_data = await resp.json(); | |
window.parent.postMessage(json_data, event.origin); | |
}); |
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
/* | |
* The main purpose of code structure is | |
* (1) to handle different upstream with different strategies, and | |
* (2) to dispatch groups to build and test | |
* (3) with common essential information delivered from upstream. | |
*/ | |
def build_only(kwargs) { | |
build(job: params.DOWNSTREAM_JOB, propagate: false, wait: false, parameters: [ | |
/* Common parameters */ |
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
# file path: `mod/__main__.py` | |
import argparse, importlib, inspect, sys | |
prog = sys.argv[0] | |
if prog.endswith('__main__.py'): | |
prog = f'python -m {__package__}' | |
else: | |
prog = prog.rsplit('/',1)[-1] |
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
r""" | |
Ref: https://www.pttweb.cc/bbs/Python/M.1398877470.A.1E7 | |
>>> data = list(range(22)); seglen = 4 | |
>>> list(map(lambda E,T=[0]:T.__setitem__(0,E[1]+(E[0]%seglen and T[0])) or T[0], enumerate(data))) | |
[0, 1, 3, 6, 4, 9, 15, 22, 8, 17, 27, 38, 12, 25, 39, 54, 16, 33, 51, 70, 20, 41] | |
>>> x = [] | |
>>> for i, v in enumerate(data): | |
... x.append(v+x[i-1] if i%seglen!=0 else v) | |
... |
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
r""" | |
>>> cases = [ | |
... ('', ''), (' ', ''), | |
... ('11 111 010 000 0', 'MORSE'), | |
... ('11111 01111 00111 00011 00001', '01234'), | |
... ('00000 10000 11000 11100 11110', '56789'), | |
... ] | |
... | |
>>> for stream, result in cases: | |
... assert ''.join(decode_stream(stream)) == result |
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
""" | |
file: /tmp/qwer.py | |
>>> @ensure_paths_exist | |
... def a(p: Path, *a, pp: Path): pass | |
... | |
>>> a('/tmp/qwer', pp='/tmp/qwer.py') | |
>>> a('/tmp/qwer.py', 1,2, pp='/tmp/qwer') | |
Traceback (most recent call last): | |
... |
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
pipeline { | |
agent any | |
stages { | |
stage('Fixed Parallel') { failFast true; parallel { | |
stage('para1') { steps { echo '' /* sh 'exit 1' //build 14 */ } } | |
stage('Para2') { | |
stages { | |
stage('p-2-1') { steps { echo '' } } | |
stage('p-2-2') { steps { echo '' } } |
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
function FindProxyForURL(url, host) { | |
if (dnsDomainIs(host, "internal.sifive.com")) { | |
return "SOCKS localhost:5566"; | |
} | |
//return "DIRECT"; | |
} |
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
// #include <string.h> | |
// for (int i=0; i<128; i++) printf("%d-%s\n", i, strerror(i)); | |
1-Operation not permitted | |
2-No such file or directory | |
3-No such process | |
4-Interrupted system call | |
5-Input/output error | |
6-Device not configured | |
7-Argument list too long | |
8-Exec format error |
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
""" | |
>>> gen(10) | |
[0, [1, [2, [3, [4, [5, [6, [7, [8, [9, []]]]]]]]]]] | |
>>> rev_by_recur(gen(10)) | |
[9, [8, [7, [6, [5, [4, [3, [2, [1, [0, []]]]]]]]]]] | |
>>> rev_by_loop(gen(10)) | |
[9, [8, [7, [6, [5, [4, [3, [2, [1, [0, []]]]]]]]]]] | |
""" | |
def gen(n): |