Skip to content

Instantly share code, notes, and snippets.

@dmitrygusev
dmitrygusev / Dockerfile
Last active Oct 4, 2018
Jenkins in Docker
View Dockerfile
FROM jenkins/jenkins:2.138.1
USER root
RUN apt-get update -y && apt-get install -y \
python-pip \
sudo
RUN pip install awscli --upgrade
View decrypt-file.py
import re
import os
import sys
from subprocess import Popen, PIPE
scriptpath=os.path.dirname(os.path.abspath(__file__))
decrypt=os.path.join(scriptpath, 'decrypt')
input_str = sys.stdin.read()
View QueryHelper.java
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.tuple.Pair;
import com.mysema.query.BooleanBuilder;
import com.mysema.query.types.Expression;
import com.mysema.query.types.Order;
import com.mysema.query.types.Predicate;
import com.mysema.query.types.expr.ComparableExpression;
@dmitrygusev
dmitrygusev / keybase.md
Created Feb 26, 2015
GitHub identity proof for Keybase.io
View keybase.md

Keybase proof

I hereby claim:

  • I am dmitrygusev on github.
  • I am dmitrygusev (https://keybase.io/dmitrygusev) on keybase.
  • I have a public key whose fingerprint is E544 E143 40C3 DC06 E8D8 4B3F E1E1 5EC6 36AE FF9C

To claim this, I am signing this object:

@dmitrygusev
dmitrygusev / XeroOAuthService.java
Created Aug 11, 2014
Using Scribe's custom RequestFactory and ConnectionFactory
View XeroOAuthService.java
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import javax.net.ssl.HttpsURLConnection;
import org.scribe.builder.api.DefaultApi10a;
import org.scribe.model.OAuthConfig;
import org.scribe.model.OAuthConstants;
import org.scribe.model.OAuthRequest;
View AppModule.java
@Advise(serviceInterface=LoginContextService.class)
public void adviseSecuritySaveRequest(MethodAdviceReceiver receiver,
final @Inject @Symbol(SymbolConstants.CHARSET) String requestEncoding,
final RequestGlobals requestGlobals, final ComponentEventLinkEncoder linkEncoder,
final LinkSource linkSource, final Cookies cookies,
TapestrySessionFactory sessionFactory)
throws SecurityException, NoSuchMethodException
{
@SuppressWarnings("unchecked")
Method method = receiver.getInterface().getDeclaredMethod("saveRequest");
@dmitrygusev
dmitrygusev / BetterJPAQuery.java
Created Nov 11, 2013
Implementing JPAQuery.count(EntityPath<?>) for QueryDSL
View BetterJPAQuery.java
/*
* Copyright 2011, Mysema Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
View AppModule.java
// Here is how I use it in my AppModule.java, note there may be no any HTTP Request when this code executing:
import xxx.web.pages.oauth.Callback;
// ...
@Contribute(OAuthServiceCatalog.class)
public void contributeOAuthServices(MappedConfiguration<String, OAuthServiceConfig> configuration,
// ...
OfflineLinkSource offlineLinkSource)
View BaseIntegrationTest.java
// see http://svn.apache.org/repos/asf/shiro/tags/shiro-root-1.2.2/core/src/test/java/org/apache/shiro/test/AbstractShiroTest.java
public class BaseIntegrationTest extends AbstractShiroTest
{
public static Registry registry;
@BeforeClass
public static void setup()
{
@dmitrygusev
dmitrygusev / AbstractWorker.java
Last active Dec 23, 2015
Tapestry Workers & Tasks
View AbstractWorker.java
package com.anjlab.spelling.web.services.workers;
import java.lang.Thread.UncaughtExceptionHandler;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import org.apache.tapestry5.ioc.Messages;