View differ.py
This file contains 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
''' | |
$ git diff --unified=0 path/to/robot | python differ.py | |
''' | |
import re | |
import sys | |
from collections import defaultdict | |
from pathlib import Path | |
from robot.api import SuiteVisitor, TestSuiteBuilder |
View post_to_slack.py
This file contains 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
'''Simple example script below is quite straightforward. | |
Although Slack recommends integrating to it by writing Apps[1], | |
the old-school webhook integration still works as well | |
[1] https://api.slack.com/start/overview | |
''' | |
import json | |
import os |
View gist:ba96380bf19b60e35049e70bb87267ef
This file contains 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
// Add this as a bookmark in the bookmark bar | |
javascript:function expand(){ var els = $('a.show'); els.map((_, el) => el.click()); if (els.length > 0){ setTimeout(expand, 1500); } }; setTimeout(expand, 0) |
View MabotLibrary.py
This file contains 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 itertools import chain | |
from robot.api import TestData | |
from robot.libraries.BuiltIn import BuiltIn | |
from robot.libraries import Dialogs | |
class MabotLibrary(object): | |
'''MabotLibrary facilitates running manual testing with Robot Framework. | |
View programmatic_rf.py
This file contains 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
# Example from https://robot-framework.readthedocs.io/en/latest/autodoc/robot.running.html#examples | |
from robot.api import TestSuite | |
suite = TestSuite('Activate Skynet') | |
suite.resource.imports.library('OperatingSystem') | |
test = suite.tests.create('Should Activate Skynet') | |
test.keywords.create('Set Environment Variable', args=['SKYNET', 'activated']) | |
test.keywords.create('Environment Variable Should Be Set', args=['SKYNET']) | |
result = suite.run(output='skynet.xml') |
View fakedata.py
This file contains 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 decimal import Decimal | |
from pprint import pprint | |
from random import choice, choices, randint | |
def random_digits(n): | |
"""Returns int with length `n`""" | |
start = 10**(n-1) | |
end = (10**n)-1 | |
return randint(start, end) |
View bedtime.sh
This file contains 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
sleep 5400 && osascript -e 'tell application "Spotify" to pause' | |
# 5400 seconds == 90 minutes |
View wrap_rf_variables.sublime-snippet
This file contains 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
<snippet> | |
<content><![CDATA[\${${SELECTION}}]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<!-- <tabTrigger>hello</tabTrigger> --> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> | |
<!-- <scope>source.python</scope> --> | |
</snippet> | |
<!-- keymap: | |
{ "keys": ["ctrl+r"], "command": "insert_snippet", "args":{"name": "Packages/User/wrap_rf_variables.sublime-snippet"}} |
View self-validating.sql
This file contains 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
-- https://stackoverflow.com/a/754570 | |
SELECT CONCAT( | |
'Sufficient and sufficiently varied month_value test data: ', | |
CASE WHEN ( | |
SELECT COUNT(DISTINCT y, m) FROM month_value | |
) > 10 | |
AND ( | |
SELECT COUNT(DISTINCT y) FROM month_value | |
) > 3 |
View script.sh
This file contains 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 -x' is wonderful if you want to see the command as well as output in a script | |
function example { | |
echo "${1}" | |
} | |
VAR="foo" | |
set -x | |
example "${VAR}" | |
# + example foo |
NewerOlder