Skip to content

Instantly share code, notes, and snippets.

View seanf's full-sized avatar

Sean Flanigan seanf

  • Brisbane, Australia
View GitHub Profile
#!/bin/sh
# Tag revisions like this:
# $ git tag -a -m "Version 0.2" v0.2 HEAD
VF=VERSION-FILE
DEFAULT_VERSION=UNKNOWN
LF='
'
@seanf
seanf / mergerepos.sh
Last active October 28, 2016 01:39
Merge Zanata repos
#!/bin/zsh -ex
# https://zanata.atlassian.net/browse/ZNTA-1391
# FIXME handle extra branches on client and api
# determine directory containing this script
SCRIPT_DIR=$( dirname "$0:A" )
oldParentVersion=30-SNAPSHOT
@seanf
seanf / jbosscli.kt
Created August 23, 2017 02:06
Idempotent jboss-cli with Kotlin
import org.jboss.`as`.cli.scriptsupport.CLI
import org.slf4j.LoggerFactory
/**
* @author Sean Flanigan <a href="mailto:sflaniga@redhat.com">sflaniga@redhat.com</a>
*/
// Refs:
// https://developer.jboss.org/wiki/AdvancedCLIScriptingWithGroovyRhinoJythonEtc
// https://github.com/wildfly/wildfly-core/pull/1501/files?diff=unified#diff-25ae58578a2f30dd07236a549dc2f8d9R62
// Note that running CLI/embed-server seems to have side effects which cause problems if you later launch wildfly
@seanf
seanf / zanata-creaper.kt
Created August 23, 2017 02:20
Configuring wildfly for Zanata with Creaper
import org.slf4j.LoggerFactory
import org.wildfly.extras.creaper.commands.datasources.AddDataSource
import org.wildfly.extras.creaper.commands.logging.AddLogger
import org.wildfly.extras.creaper.commands.logging.ChangeConsoleLogHandler
import org.wildfly.extras.creaper.commands.logging.LogLevel
import org.wildfly.extras.creaper.commands.messaging.AddQueue
import org.wildfly.extras.creaper.commands.security.AddLoginModule
import org.wildfly.extras.creaper.commands.security.AddSecurityDomain
import org.wildfly.extras.creaper.core.ManagementClient
import org.wildfly.extras.creaper.core.offline.OfflineOptions
@seanf
seanf / versions-rules.xml
Last active January 9, 2018 07:37
Versions rules for versions-maven-plugin
<ruleset comparisonMethod="maven"
xmlns="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0 http://mojo.codehaus.org/versions-maven-plugin/xsd/rule-2.0.0.xsd">
<!-- Thanks to Michael Piefel and Philip Helger: https://stackoverflow.com/a/22174801/14379 -->
<ignoreVersions>
<ignoreVersion type="regex">.*[-_\.](alpha|Alpha|ALPHA|b|beta|Beta|BETA|rc|RC|M|EA)[-_\.]?[0-9]*</ignoreVersion>
</ignoreVersions>
</ruleset>
@seanf
seanf / debugreact
Created January 22, 2018 03:05
Enables stack traces for React warnings
#!/bin/sh -e
sed -i 's/console.warn(/console.trace(/g' node_modules/react/lib/lowPriorityWarning.js
sed -i 's/console.error(/console.trace(/g' node_modules/fbjs/lib/warning.js
@seanf
seanf / tuple.md
Last active April 29, 2018 23:08 — forked from jcalz/tuple.md
TypeScript tuple inference

You can use the tuple() function in tuple.ts to infer tuple types in TypeScript and cut down on the need to repeat yourself. Without tuple(), declaring a constant of a tuple type looks like this:

const daysOfTheWeek: ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"] = 
  ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];

You can't do this:

const daysOfTheWeek = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"]; 
@seanf
seanf / functionaljava_1.8-pom.xml
Created August 23, 2018 06:49
Functional Java dependencies for Java 8
<!-- http://www.mvnrepository.com/artifact/org.functionaljava -->
<dependency>
<groupId>org.functionaljava</groupId>
<artifactId>functionaljava_1.8</artifactId>
<version>4.8</version>
</dependency>
<dependency>
<groupId>org.functionaljava</groupId>
<artifactId>functionaljava-java-core_1.8</artifactId>
<version>4.8</version>
@seanf
seanf / Instances.java
Created August 27, 2018 08:06
Clean up CDI Instances (Dependent only)
/*
* Copyright 2018, Red Hat, Inc. and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
@seanf
seanf / unit.sh
Last active August 31, 2018 07:36 — forked from tvlooy/unit.sh
Bash test: get the directory of a script
#!/bin/bash
function test {
MESSAGE=$1
RECEIVED=$2
EXPECTED=$3
if [ "$RECEIVED" = "$EXPECTED" ]; then
echo -e "\033[32m✔︎ Tested $MESSAGE"
else