Skip to content

Instantly share code, notes, and snippets.

View andrewfinnell's full-sized avatar

Andrew T. Finnell andrewfinnell

View GitHub Profile
@andrewfinnell
andrewfinnell / Calculations.md
Last active October 1, 2024 20:38
Heroes of the Storm - MVP Calculation
  • add kills

  • add assists x [LostVikings=0.75, Abathur=0.8, other=1]

  • add (timeSpentDead / gameLength) x 100 x [Murky=-1, Gall=-1, Cho=-0.85, other=-0.5]

  • add 1 if player has top hero damage of his team

  • add 1 if player has top hero damage of the match

@andrewfinnell
andrewfinnell / TestTransactionManager.java
Created September 26, 2018 13:52
Agile SDK Transaction Management
package com.agile.api;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
import static com.agile.api.CommonConstants.ATT_PAGE_TWO_MULTITEXT10;
import static com.agile.api.ItemConstants.ATT_TITLE_BLOCK_NUMBER;
import static com.agile.api.ItemConstants.CLASS_PART;
public class TestTransactionManager
@andrewfinnell
andrewfinnell / ObjectPool.java
Created June 29, 2018 14:11
[Java] ObjectPool
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @author ashwinrayaprolu
*
* @param <T>
@andrewfinnell
andrewfinnell / ThreadLocal.java
Created June 29, 2018 13:40
ThreadLocal Access (Java)
ThreadLocal<String> threadLocal = new ThreadLocal<String>();
threadLocal.set("Test"); // do this in otherThread
Thread otherThread = Thread.currentThread(); // get a reference to the otherThread somehow (this is just for demo)
Field field = Thread.class.getDeclaredField("threadLocals");
field.setAccessible(true);
Object map = field.get(otherThread);
Method method = Class.forName("java.lang.ThreadLocal$ThreadLocalMap").getDeclaredMethod("getEntry", ThreadLocal.class);
@andrewfinnell
andrewfinnell / OutInterceptor.java
Created June 29, 2018 12:11
Apache CXF Interceptors and Filters
public class OutInterceptor extends AbstractPhaseInterceptor<Message> {
public OutInterceptor() {
super(Phase.POST_MARSHAL);
}
@Override
public void handleMessage(final Message aMessage) throws Fault {
}
}
const inquirer = require('inquirer');
const fs = require('fs');
const CHOICES = fs.readdirSync(`${__dirname}/templates`);
const QUESTIONS = [
{
name: 'project-choice',
type: 'list',
message: 'What project template would you like to generate?',
@andrewfinnell
andrewfinnell / jwtRS256.sh
Created April 20, 2018 18:09 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@andrewfinnell
andrewfinnell / BufferCompareFails.js
Last active April 19, 2018 22:53
Demonstration of Buffer and Secure Password generating different results even when the input is the same.
const sp = require('secure-password');
const pwd = sp();
var b1 = Buffer.from('Apples13');
var b2 = Buffer.from('Apples13');
var h1 = pwd.hashSync(b1);
var h2 = pwd.hashSync(b2);
var c1 = h1.toString('base64');
@andrewfinnell
andrewfinnell / app.js
Created April 12, 2018 15:43 — forked from ArVan/app.js
JWT Authentication with Passport
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var index = require('./routes/index');
var user = require('./routes/user');
var auth = require('./routes/auth');
@andrewfinnell
andrewfinnell / fixdpi.exe.manifest
Created April 9, 2018 19:38
Disable dpiAware for applications which think they are DPI aware but really are not.
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
<!-- Some applications state they are dpiAware when they are not. Mainly Installation programs -->
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>false</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>