Skip to content

Instantly share code, notes, and snippets.

View tfaris's full-sized avatar

Tom Faris tfaris

  • NicheVision Inc.
  • Akron,OH
View GitHub Profile
@tfaris
tfaris / AppGestures.xml
Created August 5, 2021 16:29
Wacom AppGestures configuration for FreeCAD
<ArrayElement type="map">
<displayname>FreeCAD</displayname>
<identifier type="string">FreeCAD</identifier>
<AutoBehavior>zoom</AutoBehavior>
<ScrollUp type="map">
<input type="string">mousebutton</input>
<mousebutton type="string">right</mousebutton>
<amount type="double">1</amount>
<amountmultiplier type="double">1</amountmultiplier>
<granularity type="double">50</granularity>
@tfaris
tfaris / osiris_allele_fit.py
Created March 7, 2018 16:45
[ArmedXpert Plugin] Get OSIRIS allele fit for all alleles
src = Sources[0]
src.OpenOriginalDocument()
try:
for sample in src.AllEntries:
for locus in sample.Loci:
for allele in locus.Alleles:
peak_name = str(allele.Name)
if peak_name.endswith(' OL'):
peak_name = peak_name.replace(' OL', '')
@tfaris
tfaris / nlog_setup.py
Created March 5, 2018 20:37
[ArmedXpert Plugin] Configure NLog to log inside of ArmedXpert by using NLog.Targets.ConsoleTarget
import clr
clr.AddReference("NLog")
import NLog
cfg = NLog.Config.LoggingConfiguration()
cfg.LoggingRules.Add(
NLog.Config.LoggingRule("*", NLog.LogLevel.Trace, NLog.Targets.ConsoleTarget())
)
NLog.LogManager.Configuration = cfg
@tfaris
tfaris / load_osiris_oar.py
Created October 25, 2017 18:34
[ArmedXpert Plugin] Load an osiris .oar or .oer file
from nichevision.forensics.armedxpert.SampleSource import SampleSourceOSIRISOER
src = SampleSourceOSIRISOER(
r"filepath.oar",
True)
src.BeginLoadingSource(False)
for sample in src.AllEntries:
print sample.SampleName
@tfaris
tfaris / ArmedXpertRunArbitrarySQL.py
Created October 18, 2017 19:46
[ArmedXpert] One method for running an arbitrary SQL SELECT query using the ArmedXpert plugin editor.
editor.ClearLog()
import clr
clr.AddReference('System.Data.SQLite')
from nichevision.forensics.armedxpert.dnada.datalayer import Database
from System.Data.SQLite import SQLiteCommand
cmd = SQLiteCommand("select * from AlleleCombination", Database.SharedDatasource.Connection)
reader = cmd.ExecuteReader()
@tfaris
tfaris / retrain_example.sh
Last active February 7, 2017 06:45
Tensorflow+Inception transfer learning
# Might be missing some steps... putting this together as I go
docker run -it tensorflow/tensorflow bash
###
apt-get update
apt-get install python-virtualenv nano
mkdir ~/src && cd ~/src
virtualenv tensorflow_retrain
source ./tensorflow_retrain/bin/activate
@tfaris
tfaris / unblock_file.py
Created September 28, 2016 22:06
[ArmedXpert Plugin] Programmatically Unblock a file that has been downloaded from the internet
"""
Removes the NTFS file stream that indicates that a file has been
downloaded from the internet untrusted zone.
Requires clrtype.py library (see https://raw.githubusercontent.com/IronLanguages/main/master/Languages/IronPython/Samples/ClrType/clrtype.py).
"""
import sys
import os
import clr
import clrtype
@tfaris
tfaris / printJsonDiff.js
Last active December 1, 2015 22:42
Javascript function that logs JSON changes (not additions or deletions) found using http://tlrobinson.net/projects/javascript-fun/jsondiff to the console.
function printJsonDiff(ch){
for (var i in ch){
var el = ch[i],
header;
if (el.parentNode.parentNode.firstChild.firstElementChild && el.parentNode.parentNode.firstChild.firstElementChild.innerText === "(array)"){
header = el.parentNode.parentNode.parentNode.parentNode.firstChild.innerText + " :: " + el.parentNode.parentNode.firstChild.innerText;
}
else{
header = el.parentNode.parentNode.firstChild.innerText;
}
import requests
import time
from pyquery import PyQuery
SLEEP_TIME = 60 * 5
SERVICES = (
'SocialandGaming',
'XboxLiveCoreServices',
'PurchaseandContentUsage',
@tfaris
tfaris / gist:ff8c828229ce30fbd65d
Created July 23, 2014 21:32
Get value of __version__ attribute from a python module file
import re
s = open('C:/ProgramData/Nichevision Forensics/ArmedXpert/plugins/reports/mixture_combinations_report.py').read()
m = re.search('__version__\s*=(.*)\s?', s)
if m.groups():
v = m.groups()[0].replace("'", "").replace('"', '').strip()
print v