Skip to content

Instantly share code, notes, and snippets.

View subnetmarco's full-sized avatar
🦍
Hiring, Thinking, Coding

Marco Palladino subnetmarco

🦍
Hiring, Thinking, Coding
View GitHub Profile
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;
# perl v5.18.2 on MacOSX v10.10.2
echo "hello" > /tmp/file
alias realpath="perl -MCwd -e 'print Cwd::realpath ($ARGV[0]), qq<\n>'"
cd /tmp && realpath file
# Outputs: /private/tmp/ARRAY(0x7fb6518042e8)
$ sudo luarocks install ansicolors --verbose
os.execute: unzip -n '/Users/marco/.cache/luarocks/https___rocks.moonscript.org/manifest-5.1.zip'
Archive: /Users/marco/.cache/luarocks/https___rocks.moonscript.org/manifest-5.1.zip
inflating: manifest-5.1
Results: 1
1 (number): 0
Installing https://rocks.moonscript.org/ansicolors-1.0.2-3.src.rock...
Using https://rocks.moonscript.org/ansicolors-1.0.2-3.src.rock... switching to 'build' mode
$ busted -o spec/busted-print.lua --coverage spec/ spec/
spec/integration/admin_api/admin_api_spec.lua:
Admin API / should return Kong's version and a welcome message ... ●
Admin API / should have a Server header ... ●
Admin API POST application/x-www-form-urlencoded should not create with an invalid application/x-www-form-urlencoded body ... ●
Admin API POST application/x-www-form-urlencoded should create an entity with an application/x-www-form-urlencoded body ... ●
Admin API POST application/x-www-form-urlencoded should not create with an invalid application/x-www-form-urlencoded body ... ●
Admin API POST application/x-www-form-urlencoded should create an entity with an application/x-www-form-urlencoded body ... ●
Admin API POST application/x-www-form-urlencoded should not create with an invalid application/x-www-form-urlencoded body ... ●
@subnetmarco
subnetmarco / install-kong.sh
Last active August 29, 2015 14:26
Kong one-file installer script, with OS auto-detection.
#!/bin/bash
set -o errexit
# Force bash
if [ -z "$BASH_VERSION" ]
then
exec bash "$0" "$@"
fi
<api format="JSON">
<authentication type="header">
<description><![CDATA[This is a simple header authentication]]><description>
<parameters>
<parameter name="X-Pippo-Username" optional="false">
<description><![CDATA[Please enter here your username]]></description>
</parameter>
<parameter name="X-Pippo-Password" optional="false">
<description><![CDATA[Please enter here your password]]></description>
<?php
require_once("Bitly.php");
$bitly = new Bitly("MY_PUBLIC_KEY", "MY_PRIVATE_KEY");
// ...
?>
<object name="User">
<field>username</field>
<field>age</field>
<field array="true">emails</field>
<field array="true" object="Comment">comments</field>
</object>
<object name="Comment">
<field>id</field>
<field>text</field>
</object>
{
"name": "Mark",
"email": "mark@mashape.com"
}
<?xml version="1.0" encoding="UTF-8"?>
<api xmlns="http://mashape.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://mashape.com http://mashape.com/schema/mashape-api-3.0.xsd">
<method name="Get User" http="GET">
<url><![CDATA[/users/{id}]]></url>
<parameters>
<parameter optional="false">id</parameter>
</parameters>