Skip to content

Instantly share code, notes, and snippets.

@terrancesnyder
terrancesnyder / merge_regions.sh
Last active January 31, 2020 02:38
automated merge hbase 0.98+ - Bash script that will invoke hshell to query for regions and then perform a merge_region command but only within each regionserver (to avoid data copy/locality issues)
View merge_regions.sh
#!/bin/bash
TABLE=$1
MAX=$2
echo "Examining Table $TABLE...."
echo "scan 'hbase:meta',{ COLUMNS => 'info:server', FILTER=>\"PrefixFilter('$TABLE')\"}" | hbase shell > "$TABLE.out" 2>&1
echo "Making splits $TABLE.splits"
echo "" > "$TABLE.splits"
View gist:95a6c98c1472ccd598cfd4e32f941f73
hadoop fsck / | egrep -v '^\.+$' | grep -v corrup | grep / | grep -oh '^\S*:' | rev | cut -c 2- | rev | sort | uniq > corrupted.flst
@terrancesnyder
terrancesnyder / apiary.txt
Last active August 22, 2019 20:03
API Ary - Draft
View apiary.txt
[#ftl]
[#-- @ftlvariable name="resourceApis" type="java.util.List<com.webcohesion.enunciate.api.resources.ResourceApi>" --]
[#-- @ftlvariable name="serviceApis" type="java.util.List<com.webcohesion.enunciate.api.services.ServiceApi>" --]
[#-- @ftlvariable name="data" type="java.util.List<com.webcohesion.enunciate.api.datatype.Syntax>" --]
[#-- @ftlvariable name="title" type="java.lang.String" --]
[#-- @ftlvariable name="disableMountpoint" type="java.lang.Boolean" --]
[#-- @ftlvariable name="disableResourceLinks" type="java.lang.Boolean" --]
[#-- @ftlvariable name="apiRelativePath" type="java.lang.String" --]
[#-- @ftlvariable name="includeApplicationPath" type="java.lang.Boolean" --]
@terrancesnyder
terrancesnyder / email-template.html
Created November 13, 2018 03:20
email-template.html
View email-template.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Catalina News</title>
</head>
<link href="https://fonts.googleapis.com/css?family=Noto+Sans|Roboto:100,300,400,500" rel="stylesheet">
<style>
body {
margin: 0px auto;
View gist:df73f89715ec41a7ceb4e270d8d370e5
Exception in thread "iothread-2" java.lang.NullPointerException
at zmq.Utils.tuneTcpSocket(Utils.java:48)
at zmq.TcpListener.acceptEvent(TcpListener.java:91)
at zmq.IOObject.acceptEvent(IOObject.java:123)
at zmq.Poller.run(Poller.java:250)
at java.lang.Thread.run(Thread.java:748)
Exception in thread "iothread-2" java.lang.NullPointerException
at zmq.Utils.tuneTcpSocket(Utils.java:48)
at zmq.TcpListener.acceptEvent(TcpListener.java:91)
at zmq.IOObject.acceptEvent(IOObject.java:123)
@terrancesnyder
terrancesnyder / CustomJwtTokenStore
Created May 30, 2017 23:22 — forked from maxsap/CustomJwtTokenStore
Spring Security OAuth2 programmatic configuration.
View CustomJwtTokenStore
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
View 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
View datemath.md

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.
View variables.sql
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
View vagrant_reset_network.sh
sudo ifdown --exclude=lo -a && sudo ifup --exclude=lo -a