Skip to content

Instantly share code, notes, and snippets.

View zackbatist's full-sized avatar

Zack Batist zackbatist

View GitHub Profile
@zackbatist
zackbatist / matrix2graph.r
Last active January 20, 2018 23:21
Some useful igraph commands (R) for converting weighted adjacency matrices to graph files
# Load adjacency matrix as a graph object
library(igraph)
Load adjacency matrix:
dat=read.csv(file.choose(),header=TRUE,row.names=1,check.names=FALSE)
m=as.matrix(dat)
g=graph.adjacency(m,mode="undirected",weighted=TRUE)
@zackbatist
zackbatist / gist:9492588
Last active January 20, 2018 23:21
Nice plot template format for k-means clustering
plot(a,pch=20, col = a.km$cluster)
symbols(x=a.km$centers,circles=a.km$size, add=TRUE)
text(x=a$x,y=a$y,labels=row.names(a[1:34,]),col="red",cex=0.5)
@zackbatist
zackbatist / index.html
Last active August 29, 2015 14:00
Map of countries in M.A. Thesis
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.subunit.TUR { fill: #acb; }
.subunit.SYR { fill: #cab; }
.subunit.IRQ { fill: #abd; }
.subunit.LBN { fill: #cba; }
.subunit.ISR { fill: #abc; }
.subunit.JOR { fill: #bac; }
@zackbatist
zackbatist / MA_thesis_appendix_b.r
Last active January 20, 2018 23:22
This is the R code used for my M.A. thesis, which is also included as Appendix B in the document itself.
### INITIATE IGRAPH ###
library(igraph)
### LOAD NETWORK DATA ###
dat=read.csv(file.choose(),header=TRUE,row.names=1,check.names=FALSE)
m=as.matrix(dat)
We can make this file beautiful and searchable if this error is corrected: It looks like row 10 should actually have 12 columns, instead of 11. in line 9.
Period,Begin (cal BC),End (cal BC),Levant,Middle Euphrates,El Rouj Region,Cyprus,Northern Mesopotamian,Southern Mesopotamia,Khabur Region,Deh Luran Region,Northwestern Iran
0,,12500,Epi-Palaeolithic,,,,Epi-Palaeolithic / Zarzian,,,,
1,12500,9500,Natufian / Proto-Neolithic,,,Akrotiri Phase,,,,,
2,10500,8300,PPNA / Proto-Neolithic,Neolithic 1,,PPNA,,,,,
3,8300,7600,Early-Middle PPNB,Neolithic 2,,Sotira,,,,,
4,7600,6900,Late PPNB,Neolithic 2,El-Rouj 1,Late PPNB,Late PPNB,,,Bus Moreh,
5,6900,6400,Final PPNB / PPNC,Neolithic 3,El-Rouj 2a/b,Khirokitia,Final PPNB / Proto-Hassuna / Archaic Hassuna,Ubaid 0,Proto-Hassuna,Ali Kosh,
6,6400,5800,Yarmoukian / Amuq A,,El-Rouj 2c,Khirokitia,Archaic Hassuna / Hassuna / Samarra / Pre-Halaf / Proto-Halaf,Ubaid 1-2,Proto-Hassuna,Mohammed Jaffar / Sefid,Hajji Firuz / Hasanlu X
7,5800,5400,Jericho IX / Amuq B,,El-Rouj 2d/3,Khirokitia,Halaf,Ubaid 2,Samarra / Halaf,Surkh,Hajji Firuz / Hasanlu X
8,5400,5000,Amuq C-D,,El-Rouj 4,Khirokitia / Sotira,Northern Ubaid,Ubaid 3,,Sabz / Choga

How to create a list of reflection posts in github pages:

  1. Create a repository.
  2. Create a second branch called gh-pages.
  3. Create your index file. The goal is to have a blurb introducing your work, and then a list of dated posts.
  4. Include a folder for stylesheets, as well as a favicon, readme or whatever other resources you need to make the site functional and good-looking.
  5. In a folder called posts, drop similarly styled html files with the text replaced with the new post. In my workflow, I'm writing the posts elsewhere and then editing them to remove confidential or personally identifying information. It might be a good idea to keep a blank html template file as one of my site resources.
  6. Create a new line in the main page's html file that links to the corresponding post (structured thusly: https://username.github.io/repository/posts/post1.html) and you're all set!

Detailed media editing procedure for my thesis

My thesis involves the use of multiple GoPro action cameras, as well as an external microphone, to observe work being done from multiple angles and perspectives. This file outlines how I process all the media that I collect.

Hardware

GoPro Hero 4 Silver action cameras

Three refurbished GoPro Hero 4 Silver action cameras are used. Each writes to a 64GB microSD card, which I reformatted to the exFAT file system. exFAT limits the size of each file to 4GB, so I have to concatenate the split mp4 files using ffmpeg. Also, GoPro action cameras record notoriously poor quality audio, and attempts to clean the audio may produce varying results depending on the circumstances under which you are recording.

SONY ICD-UX560 audio recorder

I use a SONY ICD-UX560 audio recorder as an additional source for audio input, to fall back on in case cleaning the GoPro audio fails or is insufficient. It comes with 4GB of built-in storage include an additional 32GB microSD c

@zackbatist
zackbatist / SNAP DIY Database Docs.md
Last active May 1, 2019 20:23
SNAP DIY Database

Overview of the system

I put together a little DIY fieldwork database server using nearly entirely open source tools and software. It consists of a Raspberry Pi operating on a local network, which contains a MariaDB server, a SMB file sharing server, an R Shiny server, and automatic scheduled backups, but can be configured or extended to suit whatever situation you're in. This is a more collaborative and distributed setup than a typical Microsoft Access setup (or even worse, a series of scattered spreadsheets :z), since multiple users can simultaneously enter data stored in a unified and central directory, share files across the network, and browse what's going on across an entire project. Microsoft Access, on the other hand, is proprietary, expensive and windows-only software that has poor multi-user support and the learning curve is steeper than its worth (I could go on...).

Moreover, this is a very inexpensive and portable setup. In terms of hardware, you will need a 35$ Raspberry Pi, a 32GB SD card (al

Quals reading lists

Methodological approaches to understanding and representing (archaeological) knowledge work - Costis Dallas

This reading list explores the different ways in which research practice and knowledge construction may be studied. It surveys various relevant methodologies, and assesses the implications that come to bear through their use. What kinds of information are collected through different data collection protocols? How does this contribute to different research outcomes down the road? How might insights garnered through different approaches lead to different ways of extending or applying them? How might the freedom and flexibility afforded by the use of grounded theory be leveraged effectively?

Theoretical and applied approaches to cognition and action - Matt Ratto

The starting point for this reading list is the assumption that archaeological projects be considered as cooperatively constructed socio-technical mechanisms that are iteratively designed and tinkered with to construct

@zackbatist
zackbatist / GS01a.bib
Last active September 13, 2018 19:26
x
@article{pop00001,
author = {M Rothenberg},
type = {HTML},
title = {Review of Cadw Mobile App [application]},
journal = {Internet Archaeology},
publisher = {intarch.ac.uk},
url = {http://intarch.ac.uk/journal/issue44/14/},
year = {2017},
note = {Query date: 2018-09-10},
}