-
references
-
goals
- cleanest possible api to reflect data
- most useful (minimal extraneous stuff) data returned for interface-purpose
This file contains hidden or 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
| """ | |
| Skimming <https://realpython.com/working-with-files-in-python/> | |
| for some forgotten reason, I came across the section "Creating Multiple Directories", | |
| which showed how the command: | |
| ... os.makedirs( '2018/10/05' ) | |
| ...will create a hierarchy of directories like: | |
| . |
This file contains hidden or 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
| import pprint, requests | |
| def query_solr(): | |
| url = 'http://solr_url' | |
| r = requests.get( url, timeout=5 ) | |
| result = r.json() | |
| return result | |
This file contains hidden or 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
| ''' | |
| Reminder for handling querystrings outside of django. | |
| Notes... | |
| - It's legal to have duplicate keys | |
| - This is a messy, real openURL, with three foo test keys | |
| - foo1 shows that a string with a comma is still parsed as a single string | |
| - foo2 shows that a key without a val is ignored | |
| - foo3 shows that a key with an `=` but without a val is also ignored | |
| ''' |
This file contains hidden or 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
| Since this'll be replaced, archiving here my first rust randomization code... | |
| ``` | |
| pub async fn validate_bib( &self, bib: &str ) -> bool { | |
| use rand::Rng; | |
| let mut rng = rand::thread_rng(); | |
| let i: u8 = rng.gen_range( 0..2 ); // low, 0; high, 1 | |
| println!( "i, ``{:?}``", i ); | |
| if i == 0 { | |
| false |
This file contains hidden or 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
| import datetime | |
| start_time = datetime.datetime.now() | |
| with open('./5p7_gb.txt', 'rb' ) as fhandler: | |
| count = 0 | |
| for (i, line) in enumerate( fhandler ): | |
| i += 1 | |
| if b'Message-ID:' in line: | |
| count += 1 | |
| print( f'count, ``{count}``' ) |
Notes from working through Chris Hawkes':
- "Django + Babel + Webpack + React Tutorial"
- https://www.youtube.com/watch?v=Mx3ChaYA0Gw
- video from May 5, 2019; my work-through March, 2020
- Chris Hawkes youtube-channel & site
This file contains hidden or 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
| """ | |
| Usage: | |
| - cd to the `annex_accessions` directory | |
| - run $ python3 ./barcode_extractor.py | |
| """ | |
| import logging, os, pprint | |
| logging.basicConfig( |