Skip to content

Instantly share code, notes, and snippets.

View jfrazee's full-sized avatar

Joey jfrazee

View GitHub Profile
@jfrazee
jfrazee / citecut.rb
Created July 5, 2012 21:48
Cut unused entries from .bib files
require 'set'
require 'bibtex'
# Usage: ruby citecut.rb <latex> <bib>
# Get the citekeys used in the LaTeX doc
citekeys = Set.new
open(ARGV[0]).readlines.each do |line|
line.scan(/\\\w*cite\w*{([\w\d,:-]+)}/) do |c|
citekeys.merge c[0].split(',')
@jfrazee
jfrazee / twitter_filter.js
Created January 10, 2012 23:22
Twitter Streaming API with Node.js Request module
var request = require('request');
function filter(options, callback){
var params = {
uri: "https://stream.twitter.com/1/statuses/filter.json",
}
if (typeof options['oauth'] !== 'undefined'){
params.oauth = options.oauth;
delete options.oauth;
}
@jfrazee
jfrazee / README.md
Last active July 28, 2016 14:40
NIFI-2142 Cache compiled XSLT in TransformXml

NIFI-2142 Cache compiled XSLT in TransformXml

Basic Usage

Note the stark contrast between TransformXml running with and without caching:

@jfrazee
jfrazee / NIFI-3147-suggestions.diff
Created March 7, 2017 14:50
NIFI-3147-suggestions.diff
diff --git a/nifi-nar-bundles/nifi-ccda-bundle/nifi-ccda-nar/pom.xml b/nifi-nar-bundles/nifi-ccda-bundle/nifi-ccda-nar/pom.xml
index 7bb3112b9..41ddb5c05 100644
--- a/nifi-nar-bundles/nifi-ccda-bundle/nifi-ccda-nar/pom.xml
+++ b/nifi-nar-bundles/nifi-ccda-bundle/nifi-ccda-nar/pom.xml
@@ -33,7 +33,6 @@
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-ccda-processors</artifactId>
- <version>1.2.0-SNAPSHOT</version>
</dependency>
@jfrazee
jfrazee / NIFI-3585.xml
Created March 21, 2017 19:19
NIFI-3585: Add DatabaseAdapter impl for MS SQL 2008
<?xml version="1.0" ?>
<template encoding-version="1.0">
<description>Add DatabaseAdapter impl for MS SQL 2008</description>
<groupId>f23b8db4-015a-1000-3c3d-2f6bbd6e7aed</groupId>
<name>NIFI-3585</name>
<snippet>
<processGroups>
<id>f23c8dca-015a-1000-0000-000000000000</id>
<parentGroupId>f23b8db4-015a-1000-0000-000000000000</parentGroupId>
<position>
@jfrazee
jfrazee / LookupAttribute_CSV_Example.xml
Last active April 16, 2017 19:05
LookupAttribute CSV Example
<?xml version="1.0" ?>
<template encoding-version="1.0">
<description></description>
<groupId>1cd46966-0159-1000-3bc2-e181b17f75f5</groupId>
<name>LookupAttribute CSV Example</name>
<snippet>
<processGroups>
<id>77fa6bb7-015b-1000-0000-000000000000</id>
<parentGroupId>1cd46966-0159-1000-0000-000000000000</parentGroupId>
<position>
--- a/lib/em-twitter/connection.rb
+++ b/lib/em-twitter/connection.rb
@@ -137,7 +137,7 @@ module EventMachine
protected
def handle_stream(data)
- @last_response << @decoder.decode(data)
+ @last_response << (@decoder ||= BaseDecoder.new).decode(data)
if @last_response.complete?
@jfrazee
jfrazee / FilterBadGzipFiles.scala
Last active September 5, 2019 12:28
Spark job to read gzip files, ignoring corrupted files
import java.io._
import scala.io._
import java.util.zip._
// Spark
import org.slf4j.Logger
import org.apache.spark.{ SparkConf, SparkContext, Logging }
// Hadoop
import org.apache.hadoop.io.compress.GzipCodec
#!/bin/bash
# List the blobs in an Azure storage container.
echo "usage: ${0##*/} <container-name> [blob-name]"
storage_account="$AZURE_STORAGE_ACCOUNT"
storage_suffix="${AZURE_STORAGE_SUFFIX:-core.windows.net}"
container_name="$1"
access_key="$AZURE_STORAGE_KEY"
@jfrazee
jfrazee / settings.workbench.colorCustomizations.json
Created May 28, 2021 18:19
Visual Studio Code Light Sidebar
{
"workbench.colorCustomizations": {
"[Default Dark+]": {
"sideBar.foreground": "#1E1E1E",
"sideBar.background": "#F1F1F1",
"sideBarTitle.foreground": "#1E1E1E",
"sideBarSectionHeader.background": "#0000",
"sideBarSectionHeader.border": "#61616130",
"list.hoverForeground":"#FFFFFF",
"list.hoverBackground":"#007FD4",