echo “Fireanote: Creating directory $directory
cmd_mk_dir=“mkdir -p $directory
ssh $ssh_key $server $cmd_mk_dir
rc=$?
if [[ $rc != 0 ]]
then
exit $rc
fi
 
Reference
https://stackoverflow.com/questions/90418/exit-shell-script-based-on-process-exit-code

  /**

   * Validate a recaptcha token.

   *  https://developers.google.com/recaptcha

   */

  def validateRecaptcha(token: String, addr: String, secret: String, uri: URI): Boolean = {

 

    val post = new HttpPost

    post.setURI(uri)

    val urlParameters = new ArrayList[NameValuePair]

    urlParameters.add(new BasicNameValuePair(“secret”, secret))

    urlParameters.add(new BasicNameValuePair(“response”, token))

    urlParameters.add(new BasicNameValuePair(“remoteip”, addr))

    post.setEntity(new UrlEncodedFormEntity(urlParameters));

 

    val client = HttpClientBuilder.create.build

    val response = client.execute(post);

    val buffer = Try(new BufferedReader(

      new InputStreamReader(response.getEntity().getContent())))

    // actually quite difficult to read

    buffer match {  

      case Success(b) => {

        try {

          val str = Stream.continually(b.readLine).takeWhile(_ != null).mkString(“\n”)

          val json = new JSONObject(str)

          true

        } catch {

          case ex: Exception => {

            log.error(“ERR_RECAPTCHA_READ_RESPONSE”, ex)

            IOUtils.closeQuietly(b)

            false

          }

        }

      }

      case Failure(e) => {

        log.error(“ERR_RECAPTCHA_CONNECTION”, e)

        false

      }

    }

 

$ docker run –publish=7474:7474 –publish=7687:7687 –volume=$HOME/neo4j/data:/data –env=NEO4JAUTH=none neo4j &
Active database: graph.db
Directories in use:
home: /var/lib/neo4j
config: /var/lib/neo4j/conf
logs: /var/lib/neo4j/logs
plugins: /var/lib/neo4j/plugins
import: /var/lib/neo4j/import
data: /var/lib/neo4j/data
certificates: /var/lib/neo4j/certificates
run: /var/lib/neo4j/run
Starting Neo4j.
2018-02-19 14:39:01.979+0000 WARN Unknown config option: causal
clustering.discoverylistenaddress
2018-02-19 14:39:01.983+0000 WARN Unknown config option: causalclustering.raftadvertisedaddress
2018-02-19 14:39:01.983+0000 WARN Unknown config option: causal
clustering.raftlistenaddress
2018-02-19 14:39:01.983+0000 WARN Unknown config option: ha.host.coordination
2018-02-19 14:39:01.984+0000 WARN Unknown config option: causalclustering.transactionadvertisedaddress
2018-02-19 14:39:01.984+0000 WARN Unknown config option: causal
clustering.discoveryadvertisedaddress
2018-02-19 14:39:01.984+0000 WARN Unknown config option: ha.host.data
2018-02-19 14:39:01.985+0000 WARN Unknown config option: causalclustering.transactionlisten_address
2018-02-19 14:39:02.015+0000 INFO ======== Neo4j 3.3.1 ========
2018-02-19 14:39:02.073+0000 INFO Starting…
2018-02-19 14:39:03.963+0000 INFO Bolt enabled on 0.0.0.0:7687.
2018-02-19 14:39:09.160+0000 INFO Started.
2018-02-19 14:39:10.928+0000 INFO Remote interface available at http://localhost:7474/

USE []
GO

/**
* Remove foreign keys, primary keys, and tables.
*/

/* Change to desired schema */
DECLARE @schema VARCHAR(254)
select @schema = ‘dbo’

DECLARE @name VARCHAR(128)
DECLARE @constraint VARCHAR(254)
DECLARE @SQL VARCHAR(254)

/* Drop all Foreign Key constraints */
SELECT @name = (SELECT TOP 1 TABLENAME FROM INFORMATIONSCHEMA.TABLECONSTRAINTS WHERE constraintcatalog=DBNAME() AND CONSTRAINTTYPE = ‘FOREIGN KEY’
AND TABLESCHEMA=@schema ORDER BY TABLENAME)
WHILE @name is not null
BEGIN
SELECT @constraint = (SELECT TOP 1 CONSTRAINTNAME FROM INFORMATIONSCHEMA.TABLECONSTRAINTS WHERE constraintcatalog=DBNAME()
AND CONSTRAINT
TYPE = ‘FOREIGN KEY’ AND TABLENAME = @name ORDER BY CONSTRAINTNAME)
WHILE @constraint IS NOT NULL
BEGIN
SELECT @SQL = ‘ALTER TABLE [‘ + @schema + ‘].[‘ + RTRIM(@name) +’] DROP CONSTRAINT [‘ + RTRIM(@constraint) +’]’
EXEC (@SQL)
PRINT ‘Dropped FK Constraint: ‘ + @constraint + ‘ on ‘ + @name
SELECT @constraint = (SELECT TOP 1 CONSTRAINTNAME FROM INFORMATIONSCHEMA.TABLECONSTRAINTS WHERE constraintcatalog=DBNAME()
AND CONSTRAINT
TYPE = ‘FOREIGN KEY’ AND CONSTRAINTNAME <> @constraint AND TABLENAME = @name AND TABLESCHEMA=@schema
ORDER BY CONSTRAINT
NAME)
END
SELECT @name = (SELECT TOP 1 TABLENAME FROM INFORMATIONSCHEMA.TABLECONSTRAINTS WHERE constraintcatalog=DBNAME() AND CONSTRAINTTYPE = ‘FOREIGN KEY’
AND TABLESCHEMA=@schema ORDER BY TABLENAME)
END

/* Drop all Primary Key constraints */
SELECT @name = (SELECT TOP 1 TABLENAME FROM INFORMATIONSCHEMA.TABLECONSTRAINTS WHERE constraintcatalog=DBNAME() AND CONSTRAINTTYPE = ‘PRIMARY KEY’
AND TABLESCHEMA=@schema ORDER BY TABLENAME)
WHILE @name IS NOT NULL
BEGIN
SELECT @constraint = (SELECT TOP 1 CONSTRAINTNAME FROM INFORMATIONSCHEMA.TABLECONSTRAINTS WHERE constraintcatalog=DBNAME()
AND CONSTRAINT
TYPE = ‘PRIMARY KEY’ AND TABLENAME = @name ORDER BY CONSTRAINTNAME)
WHILE @constraint is not null
BEGIN
SELECT @SQL = ‘ALTER TABLE [‘ + @schema + ‘].[‘ + RTRIM(@name) +’] DROP CONSTRAINT [‘ + RTRIM(@constraint)+’]’
EXEC (@SQL)
PRINT ‘Dropped PK Constraint: ‘ + @constraint + ‘ on ‘ + @name
SELECT @constraint = (SELECT TOP 1 CONSTRAINTNAME FROM INFORMATIONSCHEMA.TABLECONSTRAINTS WHERE constraintcatalog=DBNAME()
AND CONSTRAINT
TYPE = ‘PRIMARY KEY’ AND CONSTRAINTNAME <> @constraint AND TABLENAME = @name AND TABLESCHEMA=@schema
ORDER BY CONSTRAINT
NAME)
END
SELECT @name = (SELECT TOP 1 TABLENAME FROM INFORMATIONSCHEMA.TABLECONSTRAINTS WHERE constraintcatalog=DBNAME() AND CONSTRAINTTYPE = ‘PRIMARY KEY’
AND TABLESCHEMA=@schema ORDER BY TABLENAME)
END

/* Drop all Tables */
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = ‘U’ AND category = 0 ORDER BY [name])
WHILE @name IS NOT NULL
BEGIN
SELECT @SQL = ‘DROP TABLE [‘ + @schema + ‘].[‘ + RTRIM(@name) +’]’
EXEC (@SQL)
PRINT ‘Dropped Table: ‘ + @name
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = ‘U’ AND category = 0 AND [name] > @name ORDER BY [name])
END
GO