Skip to content

Instantly share code, notes, and snippets.

@masci
masci / main.py
Created September 4, 2013 13:42
Simple Qt application embedding a PyMol instance.
#!/usr/bin/python
"""
PyMol Widget
Usage:
main.py [input_files]
Options:
-h, --help: print this screen
"""
@masci
masci / haystack_cla.txt
Created December 6, 2023 10:33 — forked from deepset-cla/haystack_cla.txt
CLA for haystack
# Contributor License Agreement
Thank you for your interest in making a Contribution to a project of Deepset GmbH, a German company having its registered office at Hermannstraße 168, 12051 Berlin, Germany (**Deepset** or **we**).
In order to clarify the intellectual property license granted with Contributions from any natural person or legal entity, Deepset must have a Contributor License Agreement (**CLA**) on file. The CLA is agreed between each Contributor and Deepset, indicating agreement to the license terms below. This license **is for your protection as a Contributor** (by a disclaimer of liability and aclause designed to protect you in case of a patent dispute) as well as the protection of Deepset and its users; **it does not change your rights to use your own Contributions** for any other purpose.
You accept and agree to the following terms and conditions for your past, present and future Contributions submitted to Deepset.
## Definitions:
**You** (or **Your**) shall mean the natural person or leg
import argparse
import os
import sys
import re
from pathlib import Path
TARGETS = (
'latest',
# (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
'''
As of zookeeper 3.4.0, the `mntr` admin command is provided for easy parsing of zookeeper stats.
This check first parses the `stat` admin command for a version number.
If the zookeeper version supports `mntr`, it is also parsed.
Duplicate information is being reported by both `mntr` and `stat` to keep backwards compatability.
@masci
masci / main.py
Created December 1, 2016 13:26
Encode/Decode Protobuf chained messages
import metric_pb2
from google.protobuf.internal.encoder import _VarintBytes
from google.protobuf.internal.decoder import _DecodeVarint32
import timeit
import random
from functools import partial
import io
N_RUNS = 10
@masci
masci / telnet and wait
Created September 30, 2014 20:35
using AppleScript to start a telnet console and wait for it to finish
#!/bin/sh
osascript <<EOF
tell application "Terminal"
activate
set _tab to do script "telnet 127.0.0.1 2001 ; exit"
delay 1
repeat while _tab exists
delay 1
end repeat
# (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import re
import win32service
from six import iteritems
from datadog_checks.checks import AgentCheck
[user]
name = Massimiliano Pippi
email = mpippi@gmail.com
signingkey = 22AA96CA
[alias]
co = checkout
ci = commit
st = status
br = branch
def pattern_filter(items, whitelist=None, blacklist=None, key=None):
"""This filters `items` by a regular expression `whitelist` and/or
`blacklist`, with the `whitelist` taking precedence. An optional `key`
function can be provided that will be passed each item.
When you have only one type of list, consider using `pattern_whitelist`
or `pattern_blacklist` for increased performance.
"""
if (whitelist and blacklist):
_pattern_filter_chain(items, whitelist, blacklist, key)
elif whitelist: