Sic. I’ve never even tried anything other than bash, but this looks cool!
printf("%s", name);
Fëanor was a douchebag.
The search for human connection doesn’t have a predefined conclusion. - pronell@lemmy.world
Live in authenticity.
Sharing is caring, censorship is lame.
Praying for you 🕯️ O Great Mita 💝
- 7 posts
- 5 comments
Edit: feedback
Thanks for all the advice! Here’s some funny feedback: it was a faulty drive 🤣 give me back my feelings 😭 obviously I’m sending it back

I have just received my Seagate 18TB IronWolf Pro HDD and the specs say that the logical sector size is 512 emulated. Moreover, Seagate says that switching to 4096 sector size is as easy as doing a quick format (Windows terminology?). I suppose on Linux this simply means creating a filesystem with that block size? For instance mkfs.ext4 -b 4096 /dev/device or - in my specific case - cryptsetup luksFormat --sector-size=4096 and then creating a file system?
What confuses me is the Arch Wiki article on advanced format that has instructions on how to use hdparm to tell the firmware to use a certain sector size.
Do I need to do the hdparm thing, which seemingly conflicts with the Seagate instructions?
Edit: feedback
Thanks for all the advice! Here’s some funny feedback: it was a faulty drive 🤣 give me back my feelings 😭 obviously I’m sending it back

I have just received my Seagate 18TB IronWolf Pro HDD and the specs say that the logical sector size is 512 emulated. Moreover, Seagate says that switching to 4096 sector size is as easy as doing a quick format (Windows terminology?). I suppose on Linux this simply means creating a filesystem with that block size? For instance mkfs.ext4 -b 4096 /dev/device or - in my specific case - cryptsetup luksFormat --sector-size=4096 and then creating a file system?
What confuses me is the Arch Wiki article on advanced format that has instructions on how to use hdparm to tell the firmware to use a certain sector size.
Do I need to do the hdparm thing, which seemingly conflicts with the Seagate instructions?
- 4 days
Good question! I guess it does matter that he’s a cofounder and CEO. I honestly don’t know how I would react if we were talking about an employee instead. I’d deliberate and make up my mind there and then. Which sheds light on the fact that the matter isn’t as black and white as my comment made it sound.
Possibly off topic:
I work within the criminal justice system and I believe cops are pigs, while I know for a fact that there are good people on the force too. I wouldn’t give up my current position just because another “lowly” employee is rotten.
- 4 days
There is no stance that Mullvad can take on this in order to make me want to stay with them, since this is not an abstract, philosophical matter. It’s simple: Daniel partially owns a pro profit company. I pay Daniel’s company some money. Daniel reaps - as he should - parts of the company’s revenue as wage (which is my money). Daniel uses that wage to fund whatever the hell he wants - as he should - with my money. I’m either fine with contributing to this or not. Period. I am not fine with it, so I’m flirting with IVPN.
In this economy, I somehow managed to get my hands on a brand new 18TB IronWolf Pro HDD for $500.
I have four 4TB SSDs on top of which I have made a logical volume with lvm, which in turn I encrypted with LUKS. Now, I want to backup everything inside that LUKS container, but I’m a little but unsure of which “layer” to copy or to clone.
- Just
cp/ddthe contents of the LUKS container like I would any other file? ddthe LUKS container itself - in other words, close the container and copy/clone the mapped volume, which is encrypted?ddthe logical LVM volume - in other words, close/“unmap”/whatever the logical volume anddd?ddthe underlying raw disks? Although I don’t see how that would be recoverable/usable/readable on the backup HDD.
The data is not critical. It’s just some Linux ISOs that would be nice to have backed up so that I don’t have to download them again.
Edit: the HDD is to be installed on the same system as the SSDs. The HDD is also going to be encrypted, but without a logical volume, since it has enough space on its own.
Please advise. 😊
I was just leaving my flat to go and buy some obligatory Saturday night peanut butter (crunchy, of course), when dmesg -w, which I was running to troubleshoot my network, suddenly looked pretty in the dark.
:3
I’d like to share my program with some friends to show off, but naturally a lot of them are on Apple products… I use clang to compile.
263 lines of code
#include <stdio.h>
#include <string.h>
//Function declarations
void promptchoice_main(void);
void promptchoice_main_again(void);
void promptinput(void);
void promptchoice_trim(void);
void executechoice(char choice_trim);
void trimnumbers(void);
void trimwhitespace(void);
void trimletters(void);
void trimspecial(void);
void specifyspecial(void);
void printresult(char input[]);
//Global variables
char choice_main = 0x00;
char choice_trim = 0x00;
char choice_detail = 0x00;
char input[1000] = "";
char previous_input[1000] = "";
//Remove specific numbers, letters, punctuation or whitespace characters from input.
int main() {
printf("\nWelcome! This program trims text by removing unwanted characters.\n");
while (1) {
if (strlen(previous_input) == 0) { // Check for previously trimmed text in memory.
promptchoice_main();
if (choice_main == 'E') { break; }
if (choice_main == 'T') {
promptinput();
promptchoice_trim();
executechoice(choice_trim);
printresult(input);
}
}
else {
promptchoice_main_again();
if (choice_main == 'E') { break; }
if (choice_main == 'T') {
promptinput();
promptchoice_trim();
executechoice(choice_trim);
printresult(input);
}
else if (choice_main == 'P') {
sprintf(input, "%s", previous_input);
printf("\nYou are trimming previously trimmed text: %s\n", input);
promptchoice_trim();
executechoice(choice_trim);
printresult(input);
}
}
}
printf("\nGoodbye!\n");
return 0;
}
//Function definitions
void promptchoice_main(void) {
while (1) {
printf("\nPress T and ENTER to trim text or E and ENTER to exit: ");
scanf("%c", &choice_main);
while (getchar() != '\n') {}
if (choice_main == 'T' || choice_main == 'E') { break; }
else { printf("\nInvalid input!\n"); }
}
return;
}
void promptchoice_main_again(void) {
while (1) {
printf("\nPress T and ENTER to trim new text, P and ENTER to trim previously trimmed text or E and ENTER to exit: ");
scanf("%c", &choice_main);
while (getchar() != '\n') {}
if (choice_main == 'T' || choice_main == 'P' || choice_main == 'E') { break; }
else { printf("\nInvalid input!\n"); }
}
return;
}
void promptinput(void) {
printf("\nEnter the text that you would like to trim and press ENTER: ");
fgets(input, sizeof input, stdin);
input[strlen(input) - 1] = '\0';
return;
}
void promptchoice_trim(void) {
while (1) {
int x = 0;
int n = 0;
printf("\nWhat would you like to trim?\n1) Numbers (1, 2, 3...)\n2) Whitespace (space, tab or newline) \n3) Letters (A,B,C... a,b,c...)\n4) Special characters (!,?, . , ...)\nType one of the above numbers and press ENTER: ");
scanf("%c", &choice_trim);
while (getchar() != '\n') {}
if (choice_trim < 0x31 || choice_trim > 0x34) { printf("\nInvalid choice!\n"); }
else if (choice_trim == 0x31) {
for (n = strlen(input) - 1; n >= 0; n--) {
if (input[n] >= 0x30 && input[n] <= 0x39) { x++; }
}
if (x == 0) { printf("\nNo numbers found!\n"); }
else { break; }
}
else if (choice_trim == 0x32) {
for (n = strlen(input) - 1; n >= 0; n--) {
if (input[n] == 0x20 || input[n] == 0x09 || input[n] == 0x0A) { x++; }
}
if (x == 0) { printf("\nNo whitespace found!\n"); }
else { break; }
}
else if (choice_trim == 0x33) {
for (n = strlen(input) - 1; n >= 0; n--) {
if (input[n] >= 0x41 && input[n] < 0x5A || input[n] >= 0x61 && input[n] <= 0x7A ) { x++; }
}
if (x == 0) { printf("\nNo letters found!\n"); }
else { break; }
}
else if (choice_trim == 0x34) {
for (n = strlen(input) - 1; n >= 0; n--) {
if (input[n] >= 0x21 && input[n] < 0x2F || input[n] >= 0x3A && input[n] < 0x40 || input[n] >= 0x5B && input[n] < 0x60 || input[n] >= 0x7B && input[n] <= 0x7E) { x++; }
}
if (x == 0) { printf("\nNo special characters found!\n"); }
else { break; }
}
}
return;
}
void executechoice(char choice_trim) {
switch (choice_trim) {
case 0x31:
trimnumbers(); // 123 etc
break;
case 0x32:
trimwhitespace(); // space, tab, newline
break;
case 0x33:
trimletters(); // ABC..., abc...
break;
case 0x34:
trimspecial(); // ! ? , . etc.
break;
}
return;
}
void trimnumbers(void) {
int n = 0;
for (n = strlen(input) - 1; n >= 0; n--) {
if (input[n] >= 0x30 && input[n] <= 0x39) { input[n] = 0x18; }
}
return;
}
void trimwhitespace(void) {
while (1) {
printf("\nType S to trim SPACE, T to trim TAB, N to trim NEWLINE or A to trim all whitespace: ");
scanf("%c", &choice_detail);
while (getchar() != '\n') {}
if (choice_detail == 'S' || choice_detail == 'T' || choice_detail == 'A') { break; }
else { printf("\nInvalid input!\n"); }
}
int n = 0;
for (n = strlen(input) - 1; n >= 0; n--) {
if (choice_detail == 'S') { if (input[n] == 0x20) { input[n] = 0x18; } } // space
else if (choice_detail == 'T') { if (input[n] == 0x09) { input[n] = 0x18; } } // tab
else if (choice_detail == 'N') { if (input[n] == 0x0A) { input[n] = 0x18; } } // newline
else if (choice_detail == 'A') { if (input[n] == 0x20 || input[n] == 0x09 || input[n] == 0x0A) { input[n] = 0x18; } }
}
return;
}
void trimletters(void) {
int x = 0;
int n = 0;
while (1) {
printf("\nType U to trim uppercase letters, L to trim lowercase letters or A to trim all letters: ");
scanf("%c", &choice_detail);
while (getchar() != '\n') {}
if (choice_detail != 'U' && choice_detail != 'L' && choice_detail != 'A') { printf("\nInvalid input!\n"); }
else if (choice_detail == 'U') {
for (n = strlen(input) - 1; n >= 0; n--) {
if (input[n] >= 0x41 && input[n] <= 0x5A) { x++; }
}
if (x == 0) { printf("\nUppercase letters not found!\n"); }
else {
for (n = strlen(input) - 1; n >= 0; n--) {
if (input[n] >= 0x41 && input[n] <= 0x5A) { input[n] = 0x18; }
}
break;
}
}
else if (choice_detail == 'L') {
for (n = strlen(input) - 1; n >= 0; n--) {
if (input[n] >= 0x61 && input[n] <= 0x7A ) { x++; }
}
if (x == 0) { printf("\nLowercase letters not found!\n"); }
else {
for (n = strlen(input) - 1; n >= 0; n--) {
if (input[n] >= 0x61 && input[n] <= 0x7A ) { input[n] = 0x18; }
}
break;
}
}
else if (choice_detail == 'A') {
for (n = strlen(input) - 1; n >= 0; n--) {
if (input[n] >= 0x41 && input[n] <= 0x5A || input[n] >= 0x61 && input[n] <= 0x7A ) { input[n] = 0x18; }
}
break;
}
}
return;
}
void trimspecial(void) {
while (1) {
printf("\nType A to trim all special characters or S to specify which character to remove: ");
scanf("%c", &choice_detail);
while (getchar() != '\n') {}
if (choice_detail == 'A' || choice_detail == 'S') { break; }
else { printf("\nInvalid input!\n"); }
}
int n = 0;
for (n = strlen(input) - 1; n >= 0; n--) {
if (choice_detail == 'A') { if (input[n] >= 0x21 && input[n] <= 0x2F || input[n] >= 0x3A && input[n] <= 0x40 || input[n] >= 0x5B && input[n] <= 0x60 || input[n] >= 0x7B && input[n] <= 0x7E) { input[n] = 0x18; } } // All whitespace
}
if (choice_detail == 'S') { specifyspecial(); } // Let user specify character.
return;
}
void specifyspecial(void) {
char choice_special = 0x00;
int x = 0;
int n = 0;
while (1) {
printf("\nEnter special character to trim and press ENTER: ");
scanf("%c", &choice_special);
while (getchar() != '\n') {}
if (choice_special < 0x21 || choice_special > 0x2F && choice_special < 0x3A || choice_special > 0x40 && choice_special < 0x5B || choice_special > 0x60 && choice_special < 0x7B || choice_special > 0x7E) { printf("\nNot a special character!\n"); }
else {
for (n = strlen(input) - 1; n >= 0; n--) {
if (input[n] == choice_special) { x++; }
}
if (x == 0) { printf("\nCharacter not found!\n"); }
else { break; }
}
}
for (n = strlen(input) - 1; n >= 0; n--) { if (input[n] == choice_special) { input[n] = 0x18; } }
return;
}
void printresult(char input[]) {
printf("\nTrimmed text:\n\n%s\n", input);
sprintf(previous_input, "%s", input); // Save trimmed text for reuse.
return;
}
//TODO
//Replace characters (uppercase/lowercase, user selected, etc).
Anybody else experiencing this? Started about an hour ago.











What is going on and how can I help? (Some innuendo.)
But seriously what is this tesseract thing that’s popping up in my feed?