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
// ==UserScript== | |
// @name Gitlab thumbs in tabs | |
// @version 1.0 | |
// @description Add thumbs up/down buttons in the "tab" section (tested with gitlab 12.7) | |
// @author Romuald Brunet <[email protected]> | |
// @match https://gitlab.com/*/merge_requests/* | |
// ^ Add your gitlab instance(s) here ^ | |
// @grant none | |
// ==/UserScript== |
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
#!/bin/bash | |
# Allow to use the subl command with +linenumber to go to line number (like vim) | |
# example: subl filename.py +208 | |
original=/usr/bin/subl | |
last="${@: -1}" | |
prev="${@:~1:1}" | |
if [ "$#" -gt 1 ] && [ -n "$last" ] && [ -n "$prev" ] && [[ "$last" =~ ^\+ ]]; then |
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 python | |
from __future__ import print_function | |
import sys | |
import socket | |
import json | |
import optparse | |
import requests | |
import websocket # websocket-client |
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 unittest.mock | |
def mock_passthrough(*args, **kwargs): | |
""" | |
A simple mock template to check that a method was called, | |
not modifying to original patched method. | |
Behave the same as mock.patch.object(), default autospec is True, | |
and side_effect is always overrided |
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
// ==UserScript== | |
// @name YR highlight graph | |
// @namespace chivil.com | |
// @version 1.0 | |
// @description Hilight the closest line to mouse on temperature graphs | |
// @author Romuald Brunet | |
// @match https://www.yr.no/place/* | |
// @grant none | |
// ==/UserScript== |
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 python | |
""" | |
This script will search python files inside directories and list use of | |
the division operator. | |
It is meant to help spot possible issues with python3 migrations | |
""" | |
import io | |
import os |
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 python | |
""" | |
grep -r for python source strings | |
Allows to search for strings splitted across multiple lines | |
""" | |
from __future__ import print_function | |
import io | |
import re |
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
class TaskPool: | |
""" | |
asyncio task pool, run no more than n tasks concurrently | |
Example: | |
>>> pool = TaskPool(5) | |
>>> todo = [session.get(url) for url in urls] | |
>>> tasks = pool.create_tasks(todo) |
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 shielded(func): | |
""" | |
Makes so an awaitable method is always shielded from cancellation | |
""" | |
@wraps(func) | |
async def wrapped(*args, **kwargs): | |
return await asyncio.shield(func(*args, **kwargs)) | |
return wrapped |
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/perl | |
=head1 evolution-in-addressbook | |
=head2 Synopsis | |
Parse a mail and tell if the From: is coming from | |
a contact in one of your evolution address books | |
=head2 Usage |