Post your coding projects

Sounds weird, what exactly did you mean by this?

The program needs SSH access to the server in order to issue that start command.

In order to do this, I need a username and password in order to log in. Which means that I need to store the password for user convenience; so they dont have to enter it ever time.

I want to write out the configuration to a text file. It is not secure to store a plain text password. That is where salt and hashing comes in.

Hashing the password will generate a 32 (i think) character alpha/numeric output. This hash is then stored. When the user enters there password, it is ran through the hash, if the hashes match, that means the user entered to correct password, and access is granted.

The problem with just hashing is that it can be hacked, because the hash will always be the same for the given password. This is where “salting” comes in.

Salt generates a random string of characters, this set of characters is the added to the password, and the combination of the salt and password are then hashed.

This way, when the user enters their password, the salt is added, and then the combination is hashed. If the stored hash equals the hash of the salt plus entered password, access is granted.

The salt makes it so that hacking methods become terrible inefficient; they are mostly left with trying to brutr force the password, which is no longer as simple, as they must now guess the random salt pkus the correct password, and in the correct order.

I probably explained thay terribly. If I missed something, someone please let me know.

1 Like

Couldn’t you create an ssh key and provide that instead of dealing with passwords being properly hashed?

My first ever proper programming project of a reasonable size.

It’s a chat bot for Twitch, that has just about anything I could think of adding. Commands, quotes, fully fledged point system, shout out other casters, ban for links and permit accordingly etc.

Re-inventing the wheel, but wanted to make it a small CLI app for DIY-ers. Written in golang and takes under 20 MB of ram.

If what you want to be doing is asking for memory and telling it to go away that’s great.

If you have a more practical task like “listen on TCP port 80 and handle every incoming request concurrently” then you start to run into problems trying to express that in terms of “give me memory, take it back, change that pointer” operations.

Never thought of that. Like I said, I am a newb programmer. I am always open to suggestions.

I like the idea. I will do some reading and see how to do it.

I did some reading on SSH keys. The only issue I am seeing is this method seems to require a lot of configuration on the part of the user. I will do some more research and see if there is an easier way to implement this that does not require as much user interaction.

Learning go

Objective: eat all the ram

package main

import (
    "fmt"
    "runtime"
)


func burn() {
    var hog []int
    for i := 0; i > -1; i++ {
        hog = append(hog, i)
    }
}

func run() {
    wait := make(chan bool)
    for i := 0; i < runtime.NumCPU(); i++ {
        go burn()
        fmt.Println("Initialized", i)
    }
    <-wait
}

func main() {
    run()
}

One weird thing is if I replace <-wait with for true {}, it basically idles and does not eat memory. I’m not passing any params to burn(), so I fail to see why. The channel just knows it’s being used for multiprocessing?

1 Like

You’re right that if that’s what you want to do, it’s very easy to express in C.

But just like @freqlabs already pointed out, that’s often not the kind of thing you want to express when programming. Most programming jobs in the world are in business domains like finance, healthcare,… You name it. When programming things for people in that domain, you’ll want to create the same feeling in your code as what you described for C.

For example: having an account object with a transfer method that transfers money to another object. Calling the method just makes the transfer happen, very straightforward. You want your code to be full of those ‘domain’ terms. And they’re very far removed from getting a free chunk of memory and pointer arithmetic.

And that’s where these higher-level languages like ruby shine. They get you to a point where you (almost) don’t have to care about these machine operations anymore. It’s mostly handled for you by the language/runtime. As a result you lose some performance, but on the other hand you get to focus more on the domain you’re working in.

1 Like

compiler optimization? With the for true {} you are not using the wait chan. I know gcc doesn’t bother compiling unused variables in c++, but I am new to golang soooooo I’m not too sure

1 Like

@khaudio, I was able to check this in c++ by compiling to assembly with and without and running diff on them, which told me that they were identical files. Apparently, the go tool compiler has -S flag that will print Assembly code. Test away my friend!

sauce

1 Like

I wrote a primitive network audio player that is async for some reason

Uses UDP sockets currently but may change to TCP later on.
The idea is to create a DIY whole-home audio system.
The ultimate idea is to have an app that activates “party mode,” which takes priority on every device running this server and immediately plays daft punk while the lights in the house go crazy with RGB. Right now the app works and this linked thing works, so it’s kind of close.

Sometimes I want to scan files before I crack em open on windows, but I don’t do it often enough to even remember the command. This reduces clamav upgrade, definition update, scanning with recursive options, and checking the output to one command.

not that much coding stuff, did some testing/fine tuning of some install scripts for arch :stuck_out_tongue:

I overhauled this over the weekend. It’s much more fleshed out now and abandons rsync for rclone so it can target cloud storage (as well as sftp and local storage).

I’ll combine it with another script that compiles a report of backup activity in a periodic notification email.

I developed my bash style in pretty much a complete vacuum, I’d be curious to see what a more seasoned person thinks of it.

built a little mini itx box to run the server thing on

found a dumb little bug in the mcli thing

just had the part where it resets a int to 0 so it doesnt print the chart to a file, in one loop too low

did some more bug checking and stuff, still workin on it about more

added a built in alias for ‘-n (listname) 1 -a’ to be ‘-snp (listname)’ since found myself doing it a bit often. ex: play a movie after current file ends and then, switch back to the normal programming right after

I’ve been playing with Rust on my Teensy 3.0 to brush up on my bare metal programming chops and catch up on new developments in the Rust ecosystem. I got an LED to turn on once at the beginning but then everything broke and I don’t know where I screwed it up yet :smiley:

dunno sounds weird lol

so far only thing is trying to diagnose a thing where once in a forever it loads the position from the copy instead of the original

am lazy so instead of copy on write, i do copy on read

which is that, when it opens tracking file for the list it has open/is playing

it makes a copy then, typically 11-25min later(90+ if a movie w.e.) then it updates the original to be the new value(usually number+1, unless it hits the end then it resets back to 1)

the benefit being is a workaround for testing for if the file was written properly as linux having disk caching, if i were to just open and try and read it, it would pass, as it can access from memory, which doesnt tell me if its fully written to the disc thru the cache and everything, which lazy to figure out, but also if the system/program whatever crashes before it updates to the new number, or it crashes during write it can just use the old one which would then be the correct value(the file that was last fully played, so it would just restart the same file when they restart the server/have it play that list)

havent figured it out yet will have to wait til i notice it again and then stop the file/cat the 2 position files before it ends, so i can see if the file just never updated/became corrupt or something, as i checked the code and couldnt find anything wrong at first glance, so was gonna check if maybe something with the way the disk is mounted/shutdown procedure might mess it up if shutdown to fast after closing server, if forces it and doesnt wait for cache, in which case i could just add a delay for the shutdown or something(on the server program itself)

An event-driven non-linear component-based note-taking web application with a focus on math.

It’s EXTREMELY early. I only set up the repo a couple hours ago. I am still working out basic user stories and other details.


Let me know your thoughts if interested.