This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# File to normalize Stata log files. Remove computer-specific, | |
# time-specific, and random components from log files. | |
# This enables identification of differences in Stata runs by | |
# using binary diffs (easy with a versioned project like one on SVN). | |
#To do: | |
# deal with the unversioned env variable (quieted for now in ipums_migr...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/sed -f | |
#### Standard Stata output #### | |
### Time/speed-specific specific | |
s/[ 0-9][0-9] [A-Z][a-z][a-z] [0-9]\{4\},\? ..:..\(:..\)\?/-normalized-/g | |
### Machine-specific | |
##OS-dependent: file path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# Rewrites a dataset without the timestamp nor junk in padding | |
# Helps making things bit-reproducible. | |
# Doesn't convert byte-order for numerical types. | |
import struct, sys, datetime, glob, tempfile, shutil, os, getopt | |
def error(message): | |
sys.stderr.write(message + '\n') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
''' | |
Normalizes a Stata .gph graph file to remove build-specific information. | |
Filepaths, dates, times, and random IDs are converted so that the file | |
will be the same no matter where it is built. | |
Pass in a file pattern (that is quoted so the shell doesn't expand it). | |
To do: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# Removed non-versioned files recursively (otherwise pipe through grep -v '\\') | |
svn status | grep ^\? | cut -c 9- | sed -e 's/\\/\//g' | xargs -Ifile rm -rf file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# renames files (and svn mv's them if in svn) | |
# not sure if this works if there is whitespace in these vars | |
# use from base of project | |
findstr=$1 | |
replacestr=$2 | |
# It currently doesn't search in hidden folders | |
# for no recursion, use: | |
# for i in * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you don't list all dependencies for code (because maybe it varies programmatically) then you can force a remake by doing 'make -B <target>. Note that it will remake all dependencies! | |
#nice-ness. Uncomment a line to enable. Default is +10 | |
#nice_prefix := nice | |
#nice_prefix := nice -n10 | |
############################# Project-specific Entries #################### | |
# which entries use parallel and need a windows gateway | |
# from $grep -r eval_synth . --include="*.do" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* all mata objects used across files (or even just all) | |
* Should be made into an mlib so you don't have to worry | |
* about including multiple times. | |
* This should also help a bit with speed. | |
*Possibly get some project-specific settings | |
*qui include ....do | |
* Load all the mata files in ado/ | |
local mata_files : dir "ado" files "*.mata" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*! converts a *.gph file to another format | |
* Required globals: dir_base | |
program gph2fmt | |
args file fmt | |
graph use "${dir_base}/fig/gph/`file'", name(toexport) | |
local temp=regexm("`file'","(.+)\.gph") | |
local file_name_base=regexs(1) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*Callable from the command line for converting a gph to eps's in the right places | |
global dir_base ".." | |
adopath ++ "${dir_base}/code/ado/" | |
gph2fmt `1'.gph eps | |
if "`2'"!=""{ | |
gph2fmt `1'.gph `2' | |
} |