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
| #!/usr/bin/env python3 | |
| # Usage: | |
| # no-proofpoint < broken_file.txt > fixed_file.txt | |
| import re, sys | |
| proofpoint_re = re.compile(r'https?://.+?/url\?u=(.+?)&d=.+?&e=') | |
| encode_re = re.compile(r'-(\w{2})') | |
| stdin = sys.stdin.read() | |
| prev = 0 | |
| for match in proofpoint_re.finditer(stdin): |
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
| ''' Usage: | |
| from pyswagger_wrapper import SwaggerClient | |
| client = SwaggerClient('your_swagger_url', headers={'auth': 'whatever', 'if': 'necessary'}) | |
| client.actions.your_op_id.call(your=params) | |
| ''' | |
| import json | |
| from urllib import request | |
| from pyswagger import App |
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 json | |
| import pprint | |
| from jsondiff import diff | |
| def prompt_merge_attr(*attrs_list): | |
| ''' Given multiple versions of an attribute dictionary, | |
| facilitate merging them into a single version. | |
| ''' | |
| final_attrs = {} | |
| all_attrs = set([ |
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
| var test = require('tape') | |
| var assert = require('assert') | |
| /** | |
| * Convert tape tests into mocha assertions! | |
| * | |
| * @example | |
| * tape_it('my mocha tape test assertion', function (test) { | |
| * test('my tape test', function (t) { | |
| * t.equal(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
| export function slice(left, right) { | |
| return { | |
| left, | |
| right, | |
| } | |
| } | |
| export function resolve_slice(s, l) { | |
| if (s === null) { | |
| return slice(0, l) |
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 { matrix_flatten, matrix_slice, slice } from './matrix' | |
| import { range } from './range' | |
| export function count_first_na(L) { | |
| for (let i = 0; i < L.length; i++) { | |
| if (L[i] != null) | |
| return i | |
| } | |
| throw new Error('NaNs not identified') | |
| } |
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
| export function range(start, end) { | |
| if (end === undefined) { | |
| end = start | |
| start = 0 | |
| } | |
| function *_range() { | |
| for(let i = start; i < end; i++) { | |
| yield i | |
| } |
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
| FROM nginx | |
| RUN rm /etc/nginx/nginx.conf | |
| ADD ./setup.sh /setup.sh | |
| ENTRYPOINT [ "/bin/bash", "/setup.sh" ] | |
| CMD [ "nginx", "-g", "daemon off;" ] |
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 React from 'react' | |
| import fitty from 'fitty' | |
| class Fitty extends React.Component { | |
| fitty_props = ['minSize', 'maxSize', 'multiLine'] | |
| constructor(props) { | |
| super(props) | |
| this.init = this.init.bind(this) |
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
| #!/usr/bin/env python3 | |
| import os | |
| import sys | |
| import glob | |
| import imagehash | |
| from PIL import Image | |
| from functools import reduce | |
| from itertools import chain |