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
class ChannelReader: | |
""" | |
Wrapper against aioredis.Channel used to allow multiple readers | |
on the same subscription | |
Example:: | |
channels = await redis_pool.subscribe('subscribeme') | |
reader = ChannelReader(channels[0]) |
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 os | |
import inspect | |
class defer: | |
""" | |
Proof of concept for a python equivalent of golang's defer statement | |
Note that the callback order is probably not guaranteed |
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 Jenkins favicon with status | |
// @version 1.0 | |
// @description Show a visual pill for Jenkins build status in the favicon (gray while building) | |
// @author Romuald Brunet <[email protected]> | |
// @match https://your-jenkins-instance/job/* | |
// @grant none | |
// ==/UserScript== | |
(function() { |
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 diff collapse | |
// @version 1.0 | |
// @description Will "properly" collapse gitlab diffs by hidding the HTML instead of using Javascript magic that hogs CPU for a long time. Tested with GitLab CE 12.7.6 | |
// @author Romuald Brunet <[email protected]> | |
// @match https://gitlab.com/* | |
// @match https://-your-gitlab-instance-/* | |
// @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
SET @uuid='31ae75f0-cbe0-11e8-a147-bc5ff4690f6a'; | |
SELECT | |
IF(SUBSTRING(@uuid, 15, 1) = '1', | |
'1582-10-15' + INTERVAL ( | |
CONV(CONCAT(SUBSTRING(@uuid, 16, 3), SUBSTRING(@uuid, 10, 4), SUBSTRING(@uuid, 1, 8)), | |
16, 10) | |
/ 10000000) SECOND, | |
NULL) AS uuid_as_timestamp; |
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 -e | |
# Small script to blame a file and recursivelly go through possible previous commits | |
# Needs the "xsel" binary / package installed | |
# Usage: reblame filename | |
# - will git blame the file on the HEAD | |
# - (user) X11 select commit id | |
# - show commit or git blame the parent of the selected commit | |
# - repeat | |
filename=$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
import pytest | |
import pprint | |
import unittest.mock | |
@pytest.fixture(autouse=True, scope='function') | |
def auto_pprint(request): | |
""" | |
Automatically sets a global "pp" variable alias to pprint in all tests | |
""" |
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/env perl | |
# Usage: anycommand | timing.pl | |
use strict; | |
use warnings; | |
use Time::HiRes qw/time/; | |
my $start = time(); | |
while (<>) { | |
printf "%.3f ", time() - $start; | |
print; |
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/sh | |
set -e | |
# 1. run the script | |
# 2. "touch" the script to play a sound | |
while :; do | |
inotifywait -q -e attrib $0 | |
ogg123 -q /usr/share/sounds/gnome/default/alerts/glass.ogg | |
done |