Skip to content

Instantly share code, notes, and snippets.

View irisdyoung's full-sized avatar

Iris Young irisdyoung

View GitHub Profile
@irisdyoung
irisdyoung / recursive_diff
Last active November 9, 2022 02:23
Recursively diff a pair of files, to allow for the same lines to be in different orders without being marked as different
#! /bin/bash
recursive_diff() {
diff $1 $2 > tmptmptmp.diff
export diffsize=`ls -l tmptmptmp.diff | awk '{ print $5 }'`
while [ ! "$diffsize" == "$newdiffsize" ]; do
export diffsize=`ls -l tmptmptmp.diff | awk '{ print $5 }'`
cat tmptmptmp.diff | grep "^<" | cut -c 3- > tmptmptmp1.phil
cat tmptmptmp.diff | grep "^>" | cut -c 3- > tmptmptmp2.phil
diff tmptmptmp1.phil tmptmptmp2.phil > tmptmptmp.diff
#! /bin/bash
# identify wherever $1 is found but not $2
for expected in `find . -name $1 | sed "s:${1}:${2}:"`
do export found=`ls $expected 2> /dev/null`
if [ ! "$found" == "$expected" ]; then
echo $expected
fi
done
#! /bin/bash
# @idyoung 2020.07.20
# Use this script in place of `ls` to list directories in a format 06Jun2020 in chronological order
export matches=`ls | grep "^[0-9][0-9][[:alpha:]][[:alpha:]][[:alpha:]][0-9][0-9][0-9][0-9]"`
export prefixed_matches=""
for match in $matches; do
export day=${match:0:2}
export month_alpha=${match:2:3}
case $month_alpha in
@irisdyoung
irisdyoung / select_differing_residues.md
Last active March 10, 2020 15:29
Jiffy script to tell you the positions of residues

snippet for selecting only differing residues based on an alignment: run the one-liner below on a file “seq” containing the alignment lines only, with all newline characters removed:

export j=0; cat seq | while read -n 1 char; do export j=$((j+1)); if [ "$char" != "*" ]; then echo -n "${j},"; fi; done; echo

in pseudocode, that's:

  1. set up a counter starting at 0

  2. feed me the contents of a file called "seq"

@irisdyoung
irisdyoung / resize_ui_for_mfx.diff
Last active April 29, 2018 07:47
XFEL UI resize for MFX displays
diff --git a/xfel/ui/components/xfel_gui_controls.py b/xfel/ui/components/xfel_gui_controls.py
index 2961dc5..02dca03 100644
--- a/xfel/ui/components/xfel_gui_controls.py
+++ b/xfel/ui/components/xfel_gui_controls.py
@@ -642,13 +642,13 @@ class RunBlock(CtrlBase):
class PHILBox(CtrlBase):
def __init__(self, parent,
btn_import=True,
- btn_import_size=(120, -1),
+ btn_import_size=(150, -1),