Skip to content

Instantly share code, notes, and snippets.

View TristinDavis's full-sized avatar

Tristin Davis TristinDavis

  • Thrivent Financial
  • Arkansas, USA
  • 20:09 (UTC -05:00)
View GitHub Profile
@TristinDavis
TristinDavis / ThrowingFunction.java
Created July 25, 2019 23:46 — forked from bbejeck/ThrowingFunction.java
Simple approach to being able to use the Function interface with checked Exceptions.
/*
* *
*
*
* Copyright 2015 Bill Bejeck
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
// imports and license left out for clarity
public class OptimizedStreams {
public static void main(String[] args) {
final Properties properties = new Properties();
properties.setProperty(StreamsConfig.APPLICATION_ID_CONFIG, "test-application");
properties.setProperty(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092 ");
properties.setProperty(StreamsConfig.TOPOLOGY_OPTIMIZATION, StreamsConfig.OPTIMIZE);
properties.setProperty(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.String().getClass().getName());
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*

Kafka 0.11.0.0 (Confluent 3.3.0) added support to manipulate offsets for a consumer group via cli kafka-consumer-groups command.

  1. List the topics to which the group is subscribed
kafka-consumer-groups --bootstrap-server <kafkahost:port> --group <group_id> --describe

Note the values under "CURRENT-OFFSET" and "LOG-END-OFFSET". "CURRENT-OFFSET" is the offset where this consumer group is currently at in each of the partitions.

  1. Reset the consumer offset for a topic (preview)
@TristinDavis
TristinDavis / okcupid user.js
Created June 2, 2019 11:59 — forked from saml/okcupid user.js
okcupid user.js
// ==UserScript==
// @name My Fancy New Userscript
// @namespace http://your.homepage/
// @version 0.1
// @description enter something useful
// @author You
// @match *://www.okcupid.com/*
// @grant none
// ==/UserScript==
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@TristinDavis
TristinDavis / msbuild-webdeploy.commandline.cmd
Last active September 9, 2016 14:02
CI WebDeploy using MSBuild - Creates WebDeployment package and then deploys that package using the given published profile name
## Deployment Step ##
```
MSBuild.exe C:\Projects\Class.csproj /P:Configuration=Debug /P:DeployOnBuild=true /P:DeployTarget=Package /P:PublishProfile=ClassOnlineProduction /P:_PackageTempDir=C:\packages /P:CreatePackageOnPublish=True /P:VisualStudioVersion=14.0
```
-- Credit to https://basitaalishan.com/2013/03/13/find-missing-indexes-using-sql-servers-index-related-dmvs/
SELECT CAST(SERVERPROPERTY('ServerName') AS [nvarchar](256)) AS [SQLServer]
,db.[database_id] AS [DatabaseID]
,db.[name] AS [DatabaseName]
,id.[object_id] AS [ObjectID]
,id.[statement] AS [FullyQualifiedObjectName]
,id.[equality_columns] AS [EqualityColumns]
,id.[inequality_columns] AS [InEqualityColumns]
,id.[included_columns] AS [IncludedColumns]
,gs.[unique_compiles] AS [UniqueCompiles]
@TristinDavis
TristinDavis / UnitTest.ts
Created August 9, 2016 20:31 — forked from brunolm/UnitTest.ts
Class to do Unit Test with TypeScript and TSTestAdapter
class Assert
{
public static AreEqual<T>(expected: T, actual: T, message: string = ""): void
{
if (expected !== actual)
{
throw "Assert.AreEqual failed. "
+ "Expected: <" + expected + ">. "
+ "Actual: <" + actual + ">. "
+ message;
@TristinDavis
TristinDavis / sublime-text-3-setup.md
Created June 24, 2016 13:23 — forked from ijy/sublime-text-3-setup.md
My Sublime Text 3 setup.

Sublime Text 3 Setup

Install Package Control

Install Package Control for easy package management.

  1. Open the console with Ctrl+`
  2. Paste in the following: