Skip to content

Instantly share code, notes, and snippets.

@mcai4gl2
mcai4gl2 / README.md
Created May 24, 2021 14:14 — forked from jgoodall/README.md
This is a sample of how to send some information to logstash via the TCP input from node.js or python.

This is a sample of how to send some information to logstash via the TCP input in nodejs or python. It assumes the logstash host is on 10.10.10.100 and the TCP listening input is 9563.

The logstash.conf should look something like the sample file.

The log message should be a stringified JSON object with the log message in the @message field.

To use, run the node script node sendMessageToLogstash.js, or the python script python sendMessageToLogstash.js

@mcai4gl2
mcai4gl2 / markdown.py
Created April 30, 2017 21:00
Print DataFrame as markdown table
import pandas as pd
from StringIO import StringIO
input_data = StringIO("""col1,col2,col3
1,2,3
4,5,6
7,8,9
""")
df = pd.read_csv(input_data, sep=",")
import tabulate
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');
task prefixNewMigrations {
fileTree(dir: 'dev/src/db/listhub').exclude({ isFilePrefixed(it.file) }).each { file ->
doLast {
def timestamp = new Date().format('yyyyMMddHHmmssSSS', TimeZone.getTimeZone('GMT'))
println "Renaming $file.name to ${timestamp}__$file.name"
file.renameTo("$file.parentFile.absolutePath$file.separator${timestamp}__$file.name")
@mcai4gl2
mcai4gl2 / gist:d32a985b695ef58cd31b
Created December 27, 2014 22:02
Example to access Github API using github.js
QUnit.test('Read user details', function() {
var github = ghClient.Github;
var user = github.getUser();
console.log(user);
QUnit.ok(user, "User shall not be undefined");
QUnit.stop();