Skip to content

Instantly share code, notes, and snippets.

View sffej's full-sized avatar
💭
Is it done yet?

FNCS sffej

💭
Is it done yet?
  • Pacific NorthWest
View GitHub Profile
@sffej
sffej / DynamicServiceActivator.java
Created November 3, 2016 20:49 — forked from arthurtsang/DynamicServiceActivator.java
Create a Spring Integration Channel programatically and register that as a Spring bean
private SubscribableChannel createInputChannel(String inputChannelName) {
PublishSubscribeChannel channel = new PublishSubscribeChannel();
channel.setBeanName(inputChannelName);
channel.setBeanFactory(applicationContext);
//channel.setApplySequence(true);
((ConfigurableApplicationContext)applicationContext).getBeanFactory().registerSingleton(inputChannelName, channel);
return channel;
}
@sffej
sffej / gist:556a60cc895436dfdd99e2e23da6e425
Created November 3, 2016 21:45 — forked from roytruelove/gist:7589536
Implementation of a dynamically generated queue listening to a pubsub. See http://stackoverflow.com/q/20126706/295797. Usage - inject this bean and call 'receive'. Receive will block until it gets another event or times out
@Scope(value = "session", proxyMode = ScopedProxyMode.TARGET_CLASS)
@Service
public class PubSubListener implements DisposableBean, InitializingBean,
ApplicationContextAware {
Logger log = LoggerFactory.getLogger(this.getClass());
private ApplicationContext ctx;
private String inputChannelName;
private QueueChannel queue;
@sffej
sffej / gist:4d662e74142645b4268b418640d81e65
Created January 13, 2017 21:43 — forked from niftynei/gist:9865193
Java Example using Apache's OLTU OAuth2 library
/// GENERAL METHODS FOR OAUTH'ING
/// using the Apache Oltu library
/// https://cwiki.apache.org/confluence/display/OLTU/Index
public String getAuthUrl() {
OAuthClientRequest request = null;
try {
request = OAuthClientRequest
.authorizationLocation("https://www.hackerschool.com/oauth/authorize")
@sffej
sffej / disable-findbugs.gradle
Created January 31, 2017 23:16 — forked from chilicat/disable-findbugs.gradle
Gradle Findbugs: This gradle script will disable findbugs until "findbugs" task is in the task graph. This allows to skip the findbugs verification for cases it is not needed.
allprojects {
// Marker Task to enable findbugs.
task findbugs(
group: "Verification",
description: """Marker task to enabled findbugs. Findbugs is by default
disabled. E.g. ( ./gradlew findbugs build )"""
)
}
subprojects {
// see build.gradle for imports
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.core.util.StatusPrinter;
...
public abstract class Utilities {
public static final Logger logger = LoggerFactory.getLogger( "AnyUniqueStringHere" );
...
public static void printLoggerState() {
@sffej
sffej / deploy.sh
Created December 22, 2017 19:17
Minimal Race-free Deployment
#!/bin/sh
# deploy.sh
N="`readlink \"$1\"`"
mv -T "$1.stage" "$1"
ln -s "$N" "$1.stage"
rm -rf "$N"
cp -aH "$1" "$N"
@sffej
sffej / create_github_tag.sh
Created January 31, 2018 21:14 — forked from cliffparnitzky/create_github_tag.sh
Simple way to create a tag via git shell and push it to repo
# creat a tag (more infos at: http://git-scm.com/book/de/ch2-12.html)
git tag -a 1.0.0 -m 'Version 1.0.0'
git push origin 1.0.0
git tag -a 1.0.0.alpha1 -m 'Version 1.0.0 alpha1'
git push origin 1.0.0.alpha1
# delete a tag
git tag -d 1.0.0
git push origin :refs/tags/1.0.0
@sffej
sffej / README.md
Created February 6, 2018 01:55 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@sffej
sffej / curl.md
Created February 22, 2018 20:55 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.