Skip to main content


User since Oct 28, 2022
42 Posts

Post Statistics

Recent Posts

0 likes • May 13, 2023
# Turns 4 spaces into tabs.
# Mostly stolen from AI
# Define the directory to process
TabCount=${2:-'4'} #Defaults to 4
# Check if directory is specified
if [ -z "$DIRECTORY" ]; then
echo "Error: Directory not specified."
exit 1
# Check if directory exists
if [ ! -d "$DIRECTORY" ]; then
echo "Error: Directory does not exist."
exit 1
# Find all files in directory and subdirectories
FILES=$(find "$DIRECTORY" -type f)
# Loop through each file and unexpand it
for FILE in $FILES; do
unexpand -t "$TabCount" "$FILE" > "$FILE.tmp"
mv "$FILE.tmp" "$FILE"
echo "Done!"


0 likes • Apr 16, 2023
#include <iostream>
#include <string> //Should already be in iostream
#include <cstdlib>
//A word score adds up the character values. a-z gets mapped to 1-26 for the values of the characters.
//wordScore [wordValue]
//Pipe in the input into stdin, or type the words yourself.
//Lowercase words only
int characterValue(const char b){
return ((b >= 'a') && (b <= 'z'))? ((b - 'a') + 1) : 0;
int main(int argc, char** argv){
//The first argument specifies if you are trying to look for a certain word score
int wordValue = (argc > 1)? std::atoi(argv[1]) : 0;
std::string line;
while(std::getline(std::cin, line)){
int sum = 0;
for(const char c : line){
sum += characterValue(c);
if(wordValue){ //If wordValue is 0 or the sum is the correct value
if(wordValue == sum){
std::cout << line << std::endl;
} else {
std::cout << sum << "\t" << line << std::endl;
return 0;

0 likes • Jan 12, 2023
#Originally made by Isaac Cook
#Modified by Leif Messinger [server_ip [server2_ip [...]]]
#To be run locally on a linux computer
if [ -e ~/.ssh/ ];
echo "SSH Key already exists on local machine"
echo "Generating SSH key on local machine"
ssh-keygen -t rsa #generates id_rsa and
chmod -R 700 ~/.ssh #Sets permissions of ssh folder
ssh-add #Adds keys (and passwords?) to ssh_agent. (hopefully doesn't require password)
echo "Loading client public key into memory"
for server
echo "Adding client public key to $server remote server authorized keys"
#Idiot Isaac Cook didn't know about ssh-copy-id
#ssh-copy-id even checks if your key already exists
#In fairness, I didn't either until researching ssh-add
ssh-copy-id -i ~/.ssh/ $server #In theory, this should prompt for a username
#ssh $server "mkdir -p ~/.ssh; #Make the folder if not already made
# echo \"$pubKey\" >> ~/.ssh/authorized_keys; #Append your public key to the server's authorized_keys
# chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys" #Set the correct permissions of those files
#echo "Adding server public key to local authorized keys"
#ssh $server "ssh-copy-id -i ~/.ssh/ \$SSH_CLIENT" #this might need some awk, as $SSH_CLIENT spits out clientip portnumber
echo "Displaying server public key"
ssh $server "cat ~/.ssh/"
#Though, he did give me a good idea
echo "Displaying keys authorized on $server (you can paste them in your authorized_keys file)"
ssh $server "cat ~/.ssh/authorized_keys"
#echo "Appending keys authorized on $server to your local authorized_keys"
#ssh $server "cat ~/.ssh/authorized_keys" >> ~/.ssh/authorized_keys
echo "SSH keys schronized successfully!"

SAM 5 words with bitmaps

0 likes • Oct 23, 2022
//Leif Messinger
//Finds all sets of 5 5 letter words that don't have duplicate letters in either themselves or each other.
//First it reads the words in and puts them in groups of their bitmasks
//After that, we recurse on each group. Before doing that, we remove the group from the set of other groups to check it against.
#include <cstdio> //getchar, printf
#include <cassert> //assert
#include <vector>
#include <set>
#include <algorithm> //std::copy_if
#include <iterator> //std::back_inserter
#define CHECK_FOR_CRLF true
#define MIN_WORDS 5
#define MAX_WORDS 5
#define WORD_TOO_LONG(len) (len != 5)
const unsigned int charToBitmask(const char bruh){
assert(bruh >= 'a' && bruh <= 'z');
return (1 << (bruh - 'a'));
void printBitmask(unsigned int bitmask){
char start = 'a';
while(bitmask != 0){
if(bitmask & 1){
bitmask >>= 1;
//Pointer needs to be deleted
const std::set<unsigned int>* getBitmasks(){
std::set<unsigned int>* bitmasksPointer = new std::set<unsigned int>;
std::set<unsigned int>& bitmasks = (*bitmasksPointer);
unsigned int bitmask = 0;
unsigned int wordLength = 0;
bool duplicateLetters = false;
for(char c = getchar(); c >= 0; c = getchar()){
if(CHECK_FOR_CRLF && c == '\r'){
if(c == '\n'){
if(!(WORD_TOO_LONG(wordLength) || duplicateLetters)) bitmasks.insert(bitmask);
bitmask = 0;
wordLength = 0;
duplicateLetters = false;
if((bitmask & charToBitmask(c)) != 0) duplicateLetters = true;
bitmask |= charToBitmask(c);
return bitmasksPointer;
void printBitmasks(const std::vector<unsigned int>& bitmasks){
for(unsigned int bruh : bitmasks){
putchar(','); putchar(' ');
//Just to be clear, when I mean "word", I mean a group of words with the same letters.
void recurse(std::vector<unsigned int>& oldBitmasks, std::vector<unsigned int> history, const unsigned int currentBitmask){
//If there's not enough words left
if(oldBitmasks.size() + (-(history.size())) + (-MIN_WORDS) <= 0){
//If there's enough words
if(history.size() >= MIN_WORDS){
//Print the list
//To make it faster, we can stop it after 5 words too
}else if(history.size() >= MAX_WORDS){
//Print the list
//Thin out the array with only stuff that matches the currentBitmask.
std::vector<unsigned int> newBitmasks;
std::copy_if(oldBitmasks.begin(), oldBitmasks.end(), std::back_inserter(newBitmasks), [&currentBitmask](unsigned int bruh){
return (bruh & currentBitmask) == 0;
while(newBitmasks.size() > 0){
//I know this modifies 'oldBitmasks' too. It's intentional.
//This makes it so that the word is never involved in any of the child serches or any of the later searches in this while loop.
const unsigned int word = newBitmasks.back(); newBitmasks.pop_back();
std::vector<unsigned int> newHistory = history;
recurse(newBitmasks, newHistory, currentBitmask | word);
int main(){
const std::set<unsigned int>* bitmasksSet = getBitmasks();
std::vector<unsigned int> bitmasks(bitmasksSet->begin(), bitmasksSet->end());
delete bitmasksSet;
recurse(bitmasks, std::vector<unsigned int>(), 0);
return 0;

C++ SigFigs

0 likes • Sep 7, 2022
#include <iostream>
#include <cstring>
int main(int argc, char** argv){
//With decimal
if(strstr(argv[1], ".") != nullptr){
int i = 0;
//Skip i to first non 0 digit
while(argv[1][i] < '1' || argv[1][i] > '9') ++i;
//If digit comes before decimal
if((argv[1] + i) < strstr(argv[1], ".")){ //Good example of pointer arithmetic
std::cout << strlen(argv[1] + i) - 1 << std::endl; //Another good example
//If digit is after decimal
std::cout << strlen(argv[1] + i) << std::endl;
//Without decimal
int m = 0;
int i = 0;
while(argv[1][i] < '1' || argv[1][i] > '9') ++i; //In case of some number like 0045
for(; argv[1][i] != '\0'; ++i){
if(argv[1][i] >= '1' && argv[1][i] <= '9') m = i + 1;
std::cout << m << std::endl;
return 0;

QM Helper

0 likes • Mar 22, 2022
//QM Helper by Leif Messinger
//Groups numbers by number of bits and shows their binary representations.
//To be used on
const minterms = prompt("Enter your minterms separated by commas").split(",").map(x => parseInt(x.trim()));
const maxNumBits = minterms.reduce(function(a, b) {
return Math.max(a, Math.log2(b));
const bitGroups = [];
for(let i = 0; i < maxNumBits; ++i){
for(const minterm of minterms){
let outputString = (minterm+" ");
//Count the bits
let count = 0;
for (var i = maxNumBits; i >= 0; --i) {
if((minterm >> i) & 1){
outputString += "1";
outputString += "0";
document.body.textContent = "";"white-space", "pre");
for(const group of bitGroups){
for(const outputString of group){
document.body.textContent += outputString + "\r\n";


No Posts Found

It looks like ThiccDaddyLOAF hasn't uploaded a post yet


Please Log In

You must be authenticated to view a user's likes

Profile Privacy

Change Password

Forgot Password?

Multi-Factor Authentication

Multi-Factor Authentication (MFA) is an authentication method that requires you to provide two or more verification factors to gain access to your account. In addition to username and password, MFA requires you to verify your email on every login, which decreases the likelihood of someone stealing your account.

Delete Account

Deleting your account is permanent. All data associated with your account will be lost.