Skip to content

Instantly share code, notes, and snippets.

console.log('init.js started');
var http = require('http');
http.get("http://127.0.0.1:8080/index.html", function(res) {
console.log("Got response: " + res.statusCode);
}).on('error', function(e) {
console.log("Got error: " + e.message);
});

Keybase proof

I hereby claim:

  • I am tripodsan on github.
  • I am tripod (https://keybase.io/tripod) on keybase.
  • I have a public key ASDN0ppKP23oRpXKyB2rZVJU6iJmxrBsukPYGjXg26Bdqgo

To claim this, I am signing this object:

<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
.test {
border: 1px solid black;
resize: both;
overflow: auto;
width: 200px;
@tripodsan
tripodsan / wp
Created October 2, 2018 08:21
Little helper to switch openwhisk namespaces
#!/bin/bash
if [ $# -eq 0 ]; then
echo "usage: wp <namespace>"
exit 1
fi
ln -sf ~/.wskprops_$1 ~/.wskprops
wsk namespace list
@tripodsan
tripodsan / getContents.md
Created April 24, 2019 07:40
wrong github getcontents

first I create a file with unicode characters. my terminal is set to utf8, so it stores it as such:

$ echo "日本" > utf8-test.txt
$ cat utf8-test.txt
日本
$ file utf8-test.txt
utf8-test.txt: UTF-8 Unicode text
  1. test
    on 2 lines.
  2. foo bar
  3. test
@tripodsan
tripodsan / cls-test.js
Last active November 21, 2019 01:34
Simple test to verify the usage of cls-hooked
/*
* Copyright 2019 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
@tripodsan
tripodsan / test.js
Created January 27, 2020 01:53
generators and promise all
async function invokePing(ow, cnt) {
log.info(`${cnt}: invoking delayed_ping`);
const result = await ow.actions.invoke({
blocking: true,
name: 'delayed_ping',
result: true,
});
log.info(`${cnt}: done.`);
return result;
}
$ npm install
installing..
....

$ cd foobar
$ cat readme.md | wd
1 3 4 5
@tripodsan
tripodsan / transaction_id.md
Created March 27, 2020 02:52
Adobe I/O Runtime Transaction ID behaviour

Transaction ID behaviour.

see ./transaction.js:

function main(params) {
  const { __ow_headers: headers = {} } = params;
  const body = {
    transactionId: process.env.__OW_TRANSACTION_ID,
    requestId: headers['x-request-id'] || 'n/a',