Skip to content

Instantly share code, notes, and snippets.

@randunel
randunel / mehlia.json
Last active September 23, 2021 08:29
{
"metadata": {
"version": "0.0.8",
"serviceId": "6073a0f9-1b6f-46b0-ab78-c7f67b28a17c",
"serviceName": "TrivagoMelia",
"domainId": "Generic",
"draft": true,
"bundleIndex": 0
},
"script": {
@randunel
randunel / pipe-eval-javascript.md
Last active August 21, 2020 10:17
Automation cloud scripting components

Eval.javascript

Executes an arbitrary JavaScript code and returns its results. Depending on its mode, Autopilot exposes different globals.

All modes

Javascript running in any of the available modes has access to ctx, an Object with lots of useful properties, see https://github.com/automationcloud/autopilot/blob/master/packages/engine/src/main/runtime.ts.

The most frequently used properties of ctx are:

  • ctx.script.getGlobal(key:string, optional:boolean=false) / ctx.script.setGlobal(key:string, value:any), used for retrieving and assigning script globals, accessible with the Value.getGlobal pipe and the Global.setGlobal action;
@randunel
randunel / demo-iterating-across-contexts.json
Created August 18, 2020 07:22
Automation cloud demo: iterating across contexts
{
"script": {
"dependencies": [],
"id": "751fca5c-61b7-4c38-a836-fe4b7106b664",
"name": "Demo: iterating across contexts",
"contexts": {
"items": [{
"id": "77b99827-0776-4ff7-a4f0-a325a569e12d",
"name": "<main>",
"type": "main",
@randunel
randunel / strace getent hosts asdqq.100.resolve.me.txt
Created June 16, 2016 13:38
strace getent hosts asdqq.100.resolve.me
execve("/usr/bin/getent", ["getent", "hosts", "asdqq.100.resolve.me"], [/* 9 vars */]) = 0
arch_prctl(ARCH_SET_FS, 0x7fe8e1814c28) = 0
set_tid_address(0x7fe8e1814c60) = 1457
mprotect(0x7fe8e1811000, 4096, PROT_READ) = 0
mprotect(0x7fe8e1a18000, 4096, PROT_READ) = 0
open("/etc/hosts", O_RDONLY|O_CLOEXEC) = 3
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
readv(3, [{"", 0}, {"127.0.0.1\tlocalhost\n::1\tlocalhos"..., 1024}], 2) = 174
readv(3, [{"", 0}, {"127.0.0.1\tlocalhost\n::1\tlocalhos"..., 1024}], 2) = 0
close(3) = 0
@randunel
randunel / up.js
Last active January 4, 2016 10:57
OpenVPN up script
#!/usr/local/bin/node
(() => {
const netnsName = 'netnsName'; // name of the network namespace
_setupNetwork(process.env);
function _setupNetwork(env) {
let device = env.dev;
let mtu = env.tun_mtu;
let localIp = env.ifconfig_local;
let localNetmask = env.route_netmask_1;
'use strict';
var spawn = require('child_process').spawn;
var fs = require('fs');
function run(cmd, args, options) {
return new Promise(resolve => {
console.log('before spawn', cmd, args);
let child = spawn(cmd, args, options);
console.log('after spawn');
@randunel
randunel / ltrace-telnet-mene.ro
Created September 16, 2014 13:56
digitalocean ltrace
__libc_start_main(0x8049a30, 3, 0xbfef33e4, 0x8056b20, 0x8056b90 <unfinished ...>
__cxa_atexit(0x804e980, 0x805e6ac, 0x805d1a4, 0x8049299, 0xb76df3e4) = 0 <0.000036>
__cxa_atexit(0x804e980, 0x805e6c4, 0x805d1a4, 0x8049299, 0xb76df3e4) = 0 <0.000033>
__cxa_atexit(0x804e980, 0x805e6b8, 0x805d1a4, 0x8049299, 0xb76df3e4) = 0 <0.000033>
__cxa_atexit(0x804f0f0, 0x805e720, 0x805d1a4, 0x8049299, 0xb76df3e4) = 0 <0.000037>
__cxa_atexit(0x8053ba0, 0x805f960, 0x805d1a4, 0x8049299, 0xb76df3e4) = 0 <0.000033>
__cxa_atexit(0x8053b90, 0x805f964, 0x805d1a4, 0x8049299, 0xb76df3e4) = 0 <0.000033>
__cxa_atexit(0x8056340, 0x805f978, 0x805d1a4, 0x8049299, 0xb76df3e4) = 0 <0.000034>
__cxa_atexit(0x8056460, 0x805f984, 0x805d1a4, 0x8049299, 0xb76df3e4) = 0 <0.000034>
__cxa_atexit(0x8056980, 0x805f990, 0x805d1a4, 0x8049299, 0xb76df3e4) = 0 <0.000033>
$ npm install graphicsmagick2
npm http GET https://registry.npmjs.org/graphicsmagick2
npm http 304 https://registry.npmjs.org/graphicsmagick2
npm http GET https://registry.npmjs.org/bindings/1.2.0
npm http 304 https://registry.npmjs.org/bindings/1.2.0
> graphicsmagick2@0.2.3 install /tmp/node_modules/graphicsmagick2
> node-gyp rebuild
make: Entering directory `/tmp/node_modules/graphicsmagick2/build'
BOARDNAME=1 RELEASE=1 ESPRUINO_1V3=1 LINUX=1 make
Generating platform configs
Generating pin info
Generating JS wrappers
WRAPPERSOURCES = src/jswrap_pin.c src/jswrap_espruino.c src/jswrap_functions.c src/jswrap_modules.c src/jswrap_process.c src/jswrap_interactive.c src/jswrap_json.c src/jswrap_object.c src/jswrap_string.c src/jswrap_number.c src/jswrap_array.c src/jswrap_arraybuffer.c src/jswrap_serial.c src/jswrap_spi_i2c.c src/jswrap_onewire.c src/jswrap_io.c libs/jswrap_fat.c libs/jswrap_math.c libs/graphics/jswrap_graphics.c libs/network/http/jswrap_http.c libs/network/cc3000/jswrap_cc3000.c
DEFINES = -DNO_ASSERT -DESPRUINO_1V3 -DUSE_FILESYSTEM -DUSE_MATH -DUSE_GRAPHICS -DUSE_NET -DUSE_CC3000 -DSEND_NON_BLOCKING -DUSB -DSTM32F1 -DARM -DFAKE_STDLIB -DSTM32 -DUSE_STDPERIPH_DRIVER=1 -DSTM32F103RC -DESPRUINOBOARD -DSTM32F10X_XL -DLINUX
Generating pin info
CC /home/mihai/projects/personal/espruino/Espruino/targetlibs/stm32f1/lib/startup_stm32f10x_hd.o
src/jspin.c: In function ‘jshIsPinValid’:
src/jspin.c:20:3: warning: comparison is always false due to limited range of data type [-Wtype-limits]
return pin < JSH_PIN_COUNT && pinInfo[pin].port!=JSH_PORT_NONE;
^
src/jspin.c: In function ‘jshGetPinFromString’:
src/jspin.c:79:7: warning: comparison is always false due to limited range of data type [-Wtype-limits]
if (pin<JSH_PORTA_COUNT) return (Pin)(JSH_PORTA_OFFSET + pin);
^
src/jspin.c:81:7: warning: comparison is always false due to limited range of data type [-Wtype-limits]
if (pin<JSH_PORTB_COUNT) return (Pin)(JSH_PORTB_OFFSET + pin);