Category Archives: Programming

Delete Duplicate Files With Bash

I needed to delete all but 1 duplicate files from a bunch of experiments. I didn't care about file names. Here's the bash - it works. #!/bin/bash declare -a list=( `find ./DIRECTORY_CONTAINING_FILES f` ); declare -a sums; cnt=${#list[@]} echo "creating … Continue reading

Posted in Programming, Simulation, Social Data Analysis, useful | 2 Comments

Counting distinct sets in a multiset in Python

If like me you suck at Python you may want to do convoluted things like count the distinct sets in some multiset. Here's one way you can do it. In this example sets are read into a defaultdict and in this … Continue reading

Posted in Programming, Python | Leave a comment

Bash is exciting! Trimming a filename to get rid of the extension and a for loop

My girlfriend asked me to write a bash script which copies directories corresponding to a file name. Folder A contains 100 directories with files Folder B contains 60 graphml files For each directory in A that has the same name … Continue reading

Posted in Programming | Leave a comment