Skip to content

Instantly share code, notes, and snippets.

@terrancesnyder
terrancesnyder / CustomJwtTokenStore
Created May 30, 2017 23:22 — forked from maxsap/CustomJwtTokenStore
Spring Security OAuth2 programmatic configuration.
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.apache.commons.lang3.SerializationUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.jwt.JwtHelper;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.security.oauth2.common.OAuth2RefreshToken;
import org.springframework.security.oauth2.common.exceptions.InvalidTokenException;
@terrancesnyder
terrancesnyder / network security groups azure.sh
Created October 25, 2016 17:41
network security groups azure.sh
root@dndubuntu1204:/home/azureuser/azure-xplat-cli-azure-dev# node bin/azure network nsg rule set armrestestgrp2n nsg2n nsgrule2n -d 'Allow incoming traffic from proxy22' -p 'Tcp' -f '15.203.169.110/16' -o '*' -e 'VirtualNetwork' -u '7000-7500' -c Allow -r Outbound
info: Executing command network nsg rule set
+ Looking up the network security group "nsg2n"
+ Setting a network security rule "nsgrule2n"
+ Looking up the network security group "nsg2n"
data: Id : /subscriptions/bfb5e0bf-124b-4d0c-9352-7c0a9f4d9948/resourceGroups/armrestestgrp2n/providers/Microsoft.Network/networkSecurityGroups/nsg2n/securityRules/nsgrule2n
data: Name : nsgrule2n
data: Type : Microsoft.Network/networkSecurityGroups/securityRules
data: Provisioning state : Succeeded
data: Description : Allow incoming traffic from proxy22
@terrancesnyder
terrancesnyder / datemath.md
Last active May 30, 2016 16:50
Date Math

Date Support

The dates used within the platform support more than simple date/time constraints. Almost all dates within the platform are strings and have special semantics when dealing with periodicity as well as general date/math functions that make it much easier to specify effective start/stop period and work within date ranges.

Basic Date Format

The basic date format is defined as YYYY-MM-DDThh:mm:ssZ where:

  • YYYY is the year.
  • MM is the month.
  • DD is the day of the month.
r.db('test').table('templates').getField('variables').concatMap(function(v) {
return v('name')
}).distinct()
@terrancesnyder
terrancesnyder / vagrant_reset_network.sh
Created May 16, 2016 20:44
Reset Vagrant Networking
sudo ifdown --exclude=lo -a && sudo ifup --exclude=lo -a
@terrancesnyder
terrancesnyder / rethinkdb_merge_pushdown_crazy.js
Created April 7, 2016 23:52
rethinkdb_merge_pushdown_crazy.js
r.db('test')
.table('templates')
.filter({ network: { id: 'USA-0034' } })
.concatMap(function(d) {
return d('layers').do(function(l) {
return l.merge({ template: d('id') })
});
})
.filter({ image_var: 'product_shot_url' })
.map(function(d) {
r.db('test').table('templates').filter({ network: { id: "USA-0008" } }).getField('layers').filter(function(v) {
return v('object').hasFields('fontFamily')
}).concatMap(function(v) {
return v('object')('fontFamily')
}).distinct()
@terrancesnyder
terrancesnyder / squid.conf
Created March 13, 2016 01:16
Squid configuration for reverse proxy and caching for store
#Recommended minimum configuration:
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8
acl localnet src 0.0.0.0/8 192.168.100.0/24 192.168.101.0/24
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
@terrancesnyder
terrancesnyder / squid.conf
Created March 12, 2016 22:43 — forked from hpcorona/squid.conf
simple squid3 configuration to allow all to connect to all
#Recommended minimum configuration:
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8
acl localnet src 0.0.0.0/8 192.168.100.0/24 192.168.101.0/24
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
@terrancesnyder
terrancesnyder / truncate.sh
Created October 4, 2015 22:00
Hbase Truncate Keep Partitions
truncate_preserve 't1'