Skip to content

Instantly share code, notes, and snippets.

@theAprel
theAprel / Role.java
Created April 26, 2018 19:32
Proposal to update Role
/**
* Called when this {@code Role} is created, either at the start of the game
* or after a player has been converted. Role logic that happens in both of
* those scenarios should be implemented here. This method is called in both
* {@link #onGameStart(mafia.Game.State)} and
* {@link #onConversion(mafia.Game.State)}.
* <p>
* The default implementation registers this {@code Role} as a
* {@link TimeSensitive}.
*
@theAprel
theAprel / json-examples.js
Created April 24, 2018 21:45
JSON engine output
{
"message": "You are Yakuza.",
"type": "system"
} {
"message": "You are Yakuza.",
"type": "system"
} {
"message": "You are Villager.",
"type": "system"
} {
#!/usr/bin/env bash
# 1st argument is video/audio source mkv
# 2nd argument is ass source mkv
# 3rd argument is output file
# 4th argument is timeshift (in milliseconds)
# When it's done, check that the number of fonts attached == largest attachment #
# Ignore Error: An attachment with the ID x was not found.
ffmpeg -i "$2" -vn -an -c:s copy temp-subtitle.ass
mkvextract attachments "$2" `seq 1 100`
D 19:35:15.7469300 PowerProcessor.PrepareHistoryForCurrentTaskList() - m_currentTaskList=191
D 19:35:15.7469300 PowerProcessor.DoTaskListForCard() - unhandled BlockType PLAY for sourceEntity [name=UNKNOWN ENTITY [cardType=INVALID] id=47 zone=HAND zonePos=2 cardId= player=2]
D 19:35:16.0250239 GameState.DebugPrintEntityChoices() - id=3 Player=REDACTED TaskList=192 ChoiceType=GENERAL CountMin=1 CountMax=1
D 19:35:16.0250239 GameState.DebugPrintEntityChoices() - Source=[name=Kazakus id=47 zone=PLAY zonePos=2 cardId=CFM_621 player=2]
D 19:35:16.0250239 GameState.DebugPrintEntityChoices() - Entities[0]=[name=UNKNOWN ENTITY [cardType=INVALID] id=75 zone=SETASIDE zonePos=0 cardId= player=2]
D 19:35:16.0250239 GameState.DebugPrintEntityChoices() - Entities[1]=[name=UNKNOWN ENTITY [cardType=INVALID] id=74 zone=SETASIDE zonePos=0 cardId= player=2]
D 19:35:16.0250239 GameState.DebugPrintEntityChoices() - Entities[2]=[name=UNKNOWN ENTITY [cardType=INVALID] id=73 zone=SETASIDE zonePos=0 cardId= player=2]
D 19:35:1
1>------ Rebuild All started: Project: Hearthstone Deck Tracker, Configuration: Debug x86 ------
2>------ Rebuild All started: Project: HDTUpdate, Configuration: Debug x86 ------
3>------ Rebuild All started: Project: HDTUninstaller, Configuration: Debug x86 ------
2> HDTUpdate -> C:\Users\theAprel\Documents\GitHub\Hearthstone-Deck-Tracker\HDTUpdate\bin\x86\Debug\HDTUpdate.exe
3> HDTUninstaller -> C:\Users\theAprel\Documents\GitHub\Hearthstone-Deck-Tracker\HDTUninstaller\bin\x86\Debug\HDTUninstaller.exe
1> Cloning into 'C:\Users\theAprel\Documents\GitHub\Hearthstone-Deck-Tracker\HearthDb'...
1> Cloning into 'C:\Users\theAprel\Documents\GitHub\Hearthstone-Deck-Tracker\HearthMirror'...
1> A subdirectory or file C:\Users\theAprel\Documents\GitHub\Hearthstone-Deck-Tracker\Hearthstone Deck Tracker\bin\x86\Debug\\Images\Bars already exists.
1> A subdirectory or file C:\Users\theAprel\Documents\GitHub\Hearthstone-Deck-Tracker\Hearthstone Deck Tracker\bin\x86\Debug\\Images\Themes already exists.
1> 1972 File(s
@theAprel
theAprel / waifu.sh
Created December 21, 2015 04:41
TriHex waifu curl interface
curl 'http://mywaif.us/request.php' -H 'Origin: http://www.twitch.tv' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.8' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: */*' -H 'Referer: http://www.twitch.tv/trihex/chat' -H 'Connection: keep-alive' --data "waifu=$i" --compressed
@theAprel
theAprel / SortedListModel<E>
Created February 7, 2015 06:15
ListModel that sorts elements at insertion. Backed by TreeSet.
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.SortedSet;
import java.util.TreeSet;
import javax.swing.AbstractListModel;
/**
*
* Modified from http://www.java2s.com/Tutorial/Java/0240__Swing/SortedListModelsortableJList.htm