Skip to content

Instantly share code, notes, and snippets.

@Tattoo
Tattoo / script.sh
Last active November 27, 2018 09:33
Bash: Disabling output of "set -x" for one command
### '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
@Tattoo
Tattoo / gist:5f0097f9c422f7b7c3491ec464d73fff
Created August 1, 2018 05:28
"Open iTerm here" context menu for Finder in OS X
# Step 1
# Open Automator
#
# Step 2
# File - New - Service
#
# Set the top dropdown boxes to Service receives selected files or folders in Finder.app
# Double click or drag Run Shell Script from the left panel, and enter the following:
if [[ -d $1 ]]; then
property default_minutes : 30
property wait_percent : 50 -- wait before starting fade
set question to "Set a sleep timer for how many minutes?"
set options to {"Don't sleep after", "Sleep after", "Cancel"}
display dialog question default answer default_minutes ¬
buttons options default button 1 giving up after 30
set {_button, _answer} to {button returned, text returned} of result
""" test.robot
*** Settings ***
Library OrchestrationLibrary
*** Test Cases ***
Configuration
[Tags] configuration
Trigger on Some condition Test 1
Trigger on Some condition test 2
Trigger on Other condition Test 2
@Tattoo
Tattoo / gist:d5cd0cc8759f3ea3dce84fba207f2a07
Created September 17, 2017 22:17
Chrome empty page that you can write on
data:text/html, <html contenteditable>
<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:
param([string]$folder)
$command="$args"
$filter = "*.*"
$Watcher = New-Object IO.FileSystemWatcher $folder, $filter -Property @{
IncludeSubdirectories = $true
EnableRaisingEvents = $true
}
Register-ObjectEvent $Watcher Changed -SourceIdentifier Watcher -Action {
$command=$event.MessageData
alias robot_clean="find . \( -name log.html -or -name report.html -or -name output.xml -or -name debug.log -or -name \"*-screenshot-*.png\" \) -exec rm -rf {} \;"
from inspect import getargspec
from types import FunctionType
from your_module import (a_method
another_method,
and_so_on)
class ExampleDynamicLibrary(object):
def __init__(self):
@Tattoo
Tattoo / keywords.py
Last active August 29, 2015 14:22
keywords.py
'''
You need to have Keywords-table as the last table inside of the suite- and
resource files. Or more clever grepping than presented below. `sed` etc. is also
fine if the output would be same as the grep command below.
$ grep -irn -A 5000 '* Keywords *' path/to/tests > my_file
$ python keywords.py my_file [how_many_scores]
or one-liner:
$ grep -irn -A 5000 '* Keywords *' path/to/tests | python keywords.py - [how_many_scores]