Autosave: 2024-11-14 12:54:37
This commit is contained in:
		
							parent
							
								
									ad2123c762
								
							
						
					
					
						commit
						b7b5c3050f
					
				
					 4 changed files with 14 additions and 39 deletions
				
			
		|  | @ -1,9 +0,0 @@ | |||
| --- | ||||
| tags: [] | ||||
| created: Monday, October 21, 2024  | ||||
| --- | ||||
| # Untitled | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|  | @ -23,8 +23,8 @@ changes_exist="$(git status --porcelain | wc -l)" | |||
| 
 | ||||
| # If no changes, exit. Else commit and push with timestamp | ||||
| if [ "$changes_exist" -eq 0 ]; then | ||||
| 		echo "No changes, exiting" | ||||
|     exit 0 | ||||
| 	echo "No changes, exiting" | ||||
| 	exit 0 | ||||
| fi | ||||
| 
 | ||||
| # echo "Standardising file-names..." | ||||
|  | @ -34,8 +34,8 @@ fi | |||
| # source ${purge_images} | ||||
| # pointless comment | ||||
| 
 | ||||
| /home/thomas/repos/neuron-zk-generator/dist/app  | ||||
| 
 | ||||
| neuron-zk-generator | ||||
| # /home/thomas/repos/neuron-zk-generator/dist/app | ||||
| 
 | ||||
| echo "Changes exist. Updating remote..." | ||||
| git pull >/dev/null 2>&1 | ||||
|  | @ -43,5 +43,4 @@ git add . | |||
| git commit -q -m "Autosave: $(date +"%Y-%m-%d %H:%M:%S")" | ||||
| git push | ||||
| 
 | ||||
| /home/thomas/repos/slack-notifier/src/index.js 'eolas' '✅ Eolas: auto-save executed'	 | ||||
| 
 | ||||
| /home/thomas/repos/slack-notifier/src/index.js 'eolas' '✅ Eolas: auto-save executed' | ||||
|  |  | |||
|  | @ -1,24 +0,0 @@ | |||
| --- | ||||
| tags: [python, file-system, procedural] | ||||
| created: Friday, October 25, 2024 | ||||
| --- | ||||
| 
 | ||||
| # File operations in Python | ||||
| 
 | ||||
| Most create, delete, move etc operations invoke the inbuilt `os` module. | ||||
| 
 | ||||
| // Add directory CRUD operations in Python | ||||
| 
 | ||||
| ## Renaming files (moving) | ||||
| 
 | ||||
| ```py | ||||
| import os | ||||
| os.rename('original-file-name.txt', 'new-file-name.txt') | ||||
| ``` | ||||
| 
 | ||||
| ## Deleting files | ||||
| 
 | ||||
| ```py | ||||
| import os | ||||
| os.remove('file-name.txt') | ||||
| ``` | ||||
|  | @ -17,6 +17,15 @@ with os.scandir("/a/directory") as dir: | |||
|         print(Path(entry).suffix) | ||||
| ``` | ||||
| 
 | ||||
| ## List files without extension | ||||
| 
 | ||||
| ```python | ||||
| 
 | ||||
| file = "/some/file/with/markdown.md" | ||||
| return os.path.splitext(os.path.basename(file))[0] | ||||
| # markdown | ||||
| ``` | ||||
| 
 | ||||
| ## Create a directory | ||||
| 
 | ||||
| ```py | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 thomasabishop
						thomasabishop