Skip to content

Instantly share code, notes, and snippets.

View SlyDen's full-sized avatar

Denys Slipetskyy SlyDen

View GitHub Profile
@SlyDen
SlyDen / tets_config.java
Last active October 23, 2015 13:55
gist from gitter: alter own config for particular test in SpringBoot application
@SpringApplicationConfiguration( TestClass.Config.class )
public class TestClass {
@Configuration
public static class Config {
// your beans
}
}
@SlyDen
SlyDen / PropertyDefaultsPostProcessor.java
Created November 25, 2015 08:57
Marcel Overdijk's example to override application.properties defaults ... should work in boot after 1.3.1 (bug in 1.3)
@Order(Ordered.LOWEST_PRECEDENCE)
public class MyFrameworkPropertyDefaultsPostProcessor implements EnvironmentPostProcessor {
private static final String DEFAULT_MY_FRAMEWORK_PROPERTIES = "defaultMyFrameworkProperties";
private static final String DEFAULT_MY_FRAMEWORK_PROPERTIES_LOCATION = "/config/myFramework-application.yml";
private YamlPropertySourceLoader propertySourceLoader = new YamlPropertySourceLoader();
@Override
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
@SlyDen
SlyDen / encrypt_data_bag.rb
Last active December 9, 2015 10:34 — forked from kcd83/encrypt_data_bag.rb
Standalone script for encrypting a json file data bag into an encrypted data bag for opscode chef .
#!/usr/bin/env ruby
if ARGV.length < 2
puts "usage: #{$0} databag.json new_encrypted_databag.json [encrypted_data_bag_secret]"
exit(1)
end
databag_file = ARGV[0]
out_file = ARGV[1]
if ARGV.length >= 3
@SlyDen
SlyDen / example-gunicorn-log.conf
Created December 17, 2015 15:50 — forked from fkei/example-gunicorn-log.conf
example gunicorn log config
[loggers]
keys=root,example.default,gunicorn.access,gunicorn.error
[logger_root]
level=DEBUG
handlers=example
[logger_example.default]
level=DEBUG
handlers=example
#!/bin/bash
# Allow toggling components to install and update based off flags
updateconsul=1
updatedocker=1
updatedockermachine=1
updatedockercompose=1
updatedockerswarm=1
consulversion="0.5.2"
# Install base packages
# -qq implies -y --force-yes
sudo apt-get install -qq curl unzip git-core ack-grep software-properties-common build-essential cachefilesd
echo ">>> Installing *.xip.io self-signed SSL"
SSL_DIR="/etc/ssl/xip.io"
DOMAIN="*.xip.io"
PASSPHRASE="vaprobash"
@SlyDen
SlyDen / auth_views.py
Created January 28, 2016 11:23 — forked from scott2b/auth_views.py
login override for whitelisting/blacklisting and new-user forwarding for use with pyramid_persona
from pyramid.view import view_config
from pyramid.security import remember
from pyramid.security import authenticated_userid
from pyramid_persona.views import verify_login
USE_WHITELIST = False
WHITELIST_REJECT_MESSAGE = 'Sorry, you are not authorized to access this site.'
WHITELIST_REJECT_REDIRECT = '/'
USE_BLACKLIST = False
BLACKLIST_REJECT_MESSAGE = 'Sorry, you are not authorized to access this site.'
from pyramid.authentication import AuthTktAuthenticationPolicy
class MyAuthenticationPolicy(AuthTktAuthenticationPolicy):
def authenticated_userid(self, request):
userid = self.unauthenticated_userid(request)
if userid:
if request.verify_userid_is_still_valid(userid):
return userid
def effective_principals(self, request):
@SlyDen
SlyDen / Dockerfile
Created February 12, 2016 11:01
clean up after apt-get-install to reduce image's size
RUN apt-get update && \
apt-get install -y --no-install-recommends curl python-pip && \
pip install requests && \
apt-get remove -y python-pip curl && \
rm -rf /var/lib/apt/lists/*
@SlyDen
SlyDen / powershell-examples.ps1
Created February 22, 2016 15:56
PowerShell snippets
($env:Path).Replace(';',"`n")