Skip to content

Instantly share code, notes, and snippets.

@firemind
firemind / findpdf
Created January 18, 2017 12:38
find pdfs
#!/bin/bash
IFS=$'\n'
for i in $(find . -name *.pdf); do
pdftotext "$i" - 2>/dev/null | sed -e s/-//g | grep -i "$1" > /dev/null
if [ $? -eq 0 ]; then
evince "$i" -l "$1"
fi
done
module GamesHelper
def parse_log_file(file)
output = ''
decision = false
options = []
choice = []
choice_counter = 0
ln = 0
lifecount = {'1' => 20, '2' => 20}
text= File.open(file).read
@firemind
firemind / gist:60311ae42a3523604e42
Created March 20, 2015 09:05
reanimator crash.log
CRASH REPORT FOR MAGARENA THREAD Thread[pool-50-thread-3,5,main]
CREATED ON 2015/03/19 07:09:43
MAGARENA VERSION 1.60, JRE 1.7.0_75, OS Linux_3.2.0-77-generic amd64
Turn : 14 Phase : SecondMain Step : ActivePlayer Player : Player2 Score : -12380
0] Player : Player1 Life : 3 Delayed : Total=0
- Hand : Village Survivors
- Hand : Plains
- Hand : Indestructibility
- Hand : Deathless Angel
@firemind
firemind / gist:b6d0f017929fb8a9cc3f
Created February 26, 2015 22:33
magarena crash log for issue 74
Exception from controller.runGame: ERROR! Root has no children but there are 8 choices
java.lang.AssertionError: ERROR! Root has no children but there are 8 choices
at magic.ai.MCTSAI.findNextEventChoiceResults(MCTSAI.java:160)
at magic.headless.HeadlessGameController.getAIChoiceResults(HeadlessGameController.java:50)
at magic.headless.HeadlessGameController.runGame(HeadlessGameController.java:33)
at magic.FiremindQueueWorker.runDuel(FiremindQueueWorker.java:179)
at magic.FiremindQueueWorker.main(FiremindQueueWorker.java:109)
CRASH REPORT FOR MAGARENA THREAD Thread[main,1,main]
CREATED ON 2015/02/26 21:05:48
module Netzke::Basepack::Grid::DefaultFilterable
extend ActiveSupport::Concern
included do
js_configure do |c|
c.initComponent = ActiveSupport::JSON::Variable.new("function(){
this.callParent();
this.filters.createFilters();
}")
end
@firemind
firemind / gist:3295638
Created August 8, 2012 14:56
vim substitute with subparts
:%s/old\/path\/\(.*.jpg\)/\=join(['new\/path\/',submatch(1)],'')/g
@firemind
firemind / gist:2936188
Created June 15, 2012 12:17
Factorial Method for Integer
class Integer
def factorial_iterative
f = 1; for i in 1..self; f *= i; end; f
end
alias :factorial :factorial_iterative
end
@firemind
firemind / cypershift_decoder.rb
Created June 14, 2012 20:35
Decoder Script for Shiftcypher by Character Likelyhood
PROBS = {
:a=>8.167,
:b=>1.492,
:c=>2.780,
:d=>4.253,
:e=>12.702,
:f=>2.288,
:g=>2.022,
:h=>6.094,
:i=>6.973,
@firemind
firemind / gist:2398378
Created April 16, 2012 12:26
Netzke Tabs for mainPanel
main_panel_config(:xtype => 'tabpanel')
js_method :process_history, <<-JS
function(token){
if (token){
tab_id = token+"_tab";
if (!this.mainPanel.getComponent(tab_id)){
comp = this.mainPanel.add({layout: 'fit', id: tab_id, closable: true});
this.loadNetzkeComponent({name: token, container: comp, callback: function(c){
comp.setTitle(c.title);
@firemind
firemind / mymodel_filter.rb
Created February 29, 2012 09:17
Netzke Checkbox Group
class MymodelFilter < Netzke::Basepack::FormPanel
def configuration
super.merge(
:items => get_groups
)
end
private
def get_groups