|
You are here |
techtldr.com | ||
| | | | |
willhaley.com
|
|
| | | | | See here an example of a custom Linux mount script, written in Python, that can be used to mount disks with /etc/fstab. The mount script is installed at /usr/bin/mount.my-command and is executable. #!/usr/bin/env python3 import sys import subprocess device = sys.argv[1] mount_point = sys.argv[2] options = sys.argv[4] # Any customization could be done here to the `mount` command that is run. mount_command = ['mount', '-o', options, device, mount_point] output = subprocess.run( mount_command, capture_output=True ) if output.returncode != 0: print("error mounting") print(output.stderr.decode('UTF-8')) sys.exit(output.returncode) See here how the custom script can then be used in /etc/fstab like any "normal" mount. | |
| | | | |
imapenguin.com
|
|
| | | | | A common task in our code is to determine the length of something. In this example, let's check the length of a string like "are you keeping up?" In Python, this is crazy easy. #!/usr/bin/env python message = "are you keeping up?" len(message) In 6510 Assembly, this is also easy. Not crazy easy, but straightforward anyway. messagelength ldx #$00 checkdel lda message,x cmp #$00 ; or whatever we're using as a delimeter beq done inx jmp checkdel done stx messagelen rts .byte messagelen 0 message .null "are ... | |
| | | | |
cyberchris.xyz
|
|
| | | | | This was an older writeup of mine that I posted before I had set up this blog. I am reposting it for my blog now. Whats this for? After stumbling upon the youtube-dl program (link to the repo), I was impressed with its functionality but found it quite inconvenient to have to leave the terminal to search for the url. This led me to write this python script that lets you search Youtube and display the video/playlist ID, all in the command line. | |
| | | | |
miparnisariblog.wordpress.com
|
|
| | | A boomerang employee is someone who leaves a company and later returns to it. Most of the time it's made to get a bump in salary without having to go through a promotion process. I worked for Amazon as a software engineer for four years. I left in 2021. Last week I got an email... | ||