Skip to content

Instantly share code, notes, and snippets.

View SlyDen's full-sized avatar

Denys Slipetskyy SlyDen

View GitHub Profile
package com.jcs.todomvc;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
@SlyDen
SlyDen / ee.js
Created March 25, 2016 16:28 — forked from koemeet/ee.js
Inverse relationships issue
// app/models/product.js
export default DS.Model.extend({
masterVariant: DS.belongsTo('product-variant'),
variants: DS.hasMany('product-variant') // only contains the variants that are not master
});
// app/models/product-variant.js
export default DS.Model.extend({
product: DS.belongsTo('product', { inverse: null }),
master: DS.attr('boolean')
class MyConfig {
private final String dogsName
private final int dogsAge
private final List<Raindeer> raindeers
static class Raindeer {
private final String name
private final String position
@JsonCreator
@SlyDen
SlyDen / nginx.conf
Created March 11, 2016 15:14 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@SlyDen
SlyDen / 0_reuse_code.js
Created March 10, 2016 11:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@SlyDen
SlyDen / README.md
Created March 3, 2016 11:38 — forked from StefanWallin/README.md
nginx ssl config with multiple SNI vhosts and A+ SSL Labs score as of 2014-11-05

Configuring nginx for SSL SNI vhosts

Gotchas

Remarks

  • My version of konklones SSL config does not have SPDY support(my nginx+openssl does not support it)
  • You need a default ssl server (example.org-default.conf).
  • Some SSL-options have to be unique across your instance, so it's easier to have them in a common file(ssl.conf).
@SlyDen
SlyDen / powershell-examples.ps1
Created February 22, 2016 15:56
PowerShell snippets
($env:Path).Replace(';',"`n")
@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/*
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 / 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.'