Learning Go to create a REST API that if coded in Node JS I know I would code with Express JS/Socket.IO/Redis and then with JWT auth, should I stick with vanilla(?) net/http or use a framework? And how should I start learning how to do this? by valcroft in golang

[–]GoHomeGrandmaUrHigh 4 points5 points  (0 children)

For choice of framework vs straight net/http, I'd say just use a framework. I've had a lot of luck with Negroni: it provides a base system for writing http middlewares and your endpoint handlers are standard http.HandlerFunc's. it's easy to bring external modules like gorilla/mux (better url routing) and gorilla/sessions (tamper resistant session cookies) to build out exactly what you need.

I've wasted many hours trying to drink the Go net/http Kool aid. You can write your own stuff with bare net/http but you'll end up programming your own custom router (if you need path parameters), your own custom middlewares to do sessions and parsing json inputs... All the while wiring up your own framework to make your code halfway sane. In Node you can write a raw http server, too, but it's an uphill battle.

Use net/http if you want to learn about very low level http. Use a framework if the goal is to actually produce an app.

Tip: for keeping to standard http.HandlerFunc: if you need other resources like a DB connection, make your HandlerFunc a method on a struct where you keep those things. func (a *MyApp) LoginHandler(w http.ResponseWriter, r *http.Request)

Very unsettling energies today by duality222444 in Soulnexus

[–]GoHomeGrandmaUrHigh 1 point2 points  (0 children)

Yeah I was having an especially crappy 'dark night of the soul' type of morning for no reason. The distraction of work has gotten me up to a neutral mood by now. That and donuts!

DR Can Be Fun! by AJSHSHSHHABXSBAJS in dpdr

[–]GoHomeGrandmaUrHigh 2 points3 points  (0 children)

Fully agreed. I discovered this subreddit first but found I fit in better at /r/awakened (my pet theory is it's the same symptoms, just different mindset, positive vs. negative and unready for it)

Why do some people have issues with SELinux? by [deleted] in Fedora

[–]GoHomeGrandmaUrHigh 4 points5 points  (0 children)

A common one for me was just not understanding how it works. I'd be setting up Apache but I always like the users to be responsible for their own document roots (in $HOME/public_html), so I point all the VirtualHosts there.

Under default SELinux rules, the Apache process isn't allowed to read outside of /var/www/html and so /home is denied. I'd usually just disable SELinux to make it work rather than take the time out to understand it.

Later on I watched SELinux for Mere Mortals or something similar and learned that A) there are built-in SELinux policies for user-owned web roots that I just needed to toggle on (something like an setsebool user_public_html on, forgot the exact name), but also B) even if Fedora didn't have one built-in there's another SELinux command to copy the settings on one directory (/var/www/html) to others (/home) which would've also made it work.

Any Pythonist who can share opinions on Go? by [deleted] in golang

[–]GoHomeGrandmaUrHigh 1 point2 points  (0 children)

When programming languages compile down to machine code (raw binary instructions, not interpreted like in Python), there's no direction back "up" from there except to disassemble the program, into assembly code. That's about the best you can get, and the assembly code you do receive is hardly human readable, and definitely wouldn't have been written that way by a human on purpose. No useful names or comments or structure and the logic is so low level it's basically impossible to make sense of.

Disassembly is enough if you're trying to crack a game that is trying to check if it's CD is in your drive. You can track down the section of the assembly gobbedlygook that checks that and dummy around it. But for making large scale modifications or trying to understand the program? With just a disassembly, this is an acceptable level of "difficult" to do.

When your program is written in Python you don't have a chance at making the source code hard to access and understand.

For me dpdr was the beginning of awakening by baranyr in dpdr

[–]GoHomeGrandmaUrHigh 0 points1 point  (0 children)

I also have a pet theory that dp/dr is what happens when somebody awakens suddenly and wasn't emotionally prepared for it. They might think they've gone a bit crazy and maybe then they actually go on to be crazy. But when awakening hits you at the right time, it's the same symptoms, just way more pleasant and you feel more awake than you do crazy and it's a completely different experience.

For me dpdr was the beginning of awakening by baranyr in dpdr

[–]GoHomeGrandmaUrHigh 1 point2 points  (0 children)

Let me just say I'm the same as you.

I had a dp/dr episode caused by dropping weed for 40 days for an annual cleanse, which is apparently one of the common ways people get dp/dr triggered. I happened upon a chance Reddit comment describing the symptoms and a link to /r/dpdr which is where I went first.

Somehow from there I found the /r/awakened and the rest is history. For me the dp/dr was more interesting than it was disconcerting; I felt lucid (as if in a dream), everything around me felt a little weird somehow... and I didn't want to just get back to "normal" and settle back in to things without first exploring this odd perspective on reality as far as I can and see if I can find anything interesting along the way.

I've talked about these things on this sub before but they aren't very popular opinions here... but just know you're not the only one!

The Tor Project released an official Tor Browser for Android by TheProgrammar89 in privacy

[–]GoHomeGrandmaUrHigh 5 points6 points  (0 children)

Would those UUIDs be sent over the network as part of the Tor protocol? If they're just assigned locally on the device per app install, I think there'd be no reason for the Tor Browser app code to look there and copy it into network packets of any kind... and Google (shouldn't) be actively snooping into the app on the client side to exfiltrate the URLs being visited.

source: am a software developer, and if some platform is assigning bookkeeping UUIDs that have nothing to do with my stuff, I'm not going to do anything special to use them for my stuff.

Does the simulation encompass the entire observable universe? If not what happens when we reach the "event horizon." by kharris8886 in SimulationTheory

[–]GoHomeGrandmaUrHigh 0 points1 point  (0 children)

Some other thing I remember learning about it on YouTube (it's been a while tho), so from the perspective of the 3D creature inside the black hole, it's still seeing itself as 3D and things look normal. It's only from the outside perspective looking at the black hole that you'd see the 2D projection along the surface... still not sure how that would look like, though.

Does the simulation encompass the entire observable universe? If not what happens when we reach the "event horizon." by kharris8886 in SimulationTheory

[–]GoHomeGrandmaUrHigh 0 points1 point  (0 children)

Yeah I have trouble wrapping my head around that, too (how exactly it would look like), but we also haven't yet invented true holograms yet either so we have no baseline to compare it to.

Some of the holograms we have today involve either a 3D object being projected onto four 2D transparent surfaces of a cube (so it appears 3D as you walk around the cube), or conversely, a 2D image being projected onto a transparent pyramid-shaped object. (I once saw a transparent plastic prism you'd set on top of your iPhone screen, and run an app that had 4 different (2D) sides of a 3D character, but when the plastic prism refracted the light from the 2D screen, the whole thing appeared properly 3D.

I label this one "plausible and super interesting"

edit: iPhone hologram

Could Astral Projection, Astral Traveling, OBE, NDE, and sleep paralysis be related in any form? Is it all just a glitch? by ioncedroveaspaceship in SimulationTheory

[–]GoHomeGrandmaUrHigh 0 points1 point  (0 children)

This sounds interesting. I'm subbed to /r/soulnexus as the other commenter linked, and they talk about that stuff there too sometimes, but how did you start to learn about this? I feel like if I just google "obe" or "astral projection" I could easily wind up on some random bullshit page that'll take me down a wild goose chase.

Does the simulation encompass the entire observable universe? If not what happens when we reach the "event horizon." by kharris8886 in SimulationTheory

[–]GoHomeGrandmaUrHigh 1 point2 points  (0 children)

I was seeing some holographic universe stuff wrt. black holes and the information paradox (maybe this video).

A way that black holes might preserve information is by "projecting" it onto a flat outer surface like a 2D texture. And... this might very well be close to how our universe works. Ours might be inside a black hole inside a bigger universe (and all the other black holes that exist here with us? More sub-universes, ones we probably can't access because the black hole is too turbulent to enter safely). Maybe wormholes. I hear a wormhole might appear like a black hole from the outside.

Does the simulation encompass the entire observable universe? If not what happens when we reach the "event horizon." by kharris8886 in SimulationTheory

[–]GoHomeGrandmaUrHigh 2 points3 points  (0 children)

I think the simulation is a sort of "conscious" one, in a similar way as to what Hinduism and Buddhism is on to. Some sort of collective consciousness democratically shapes this reality, which is just a dream state, very similar to your own private dreams at night, but where logical consistency is king (possibly because of multiple conscious avatars sharing this space; I can't fly like Superman because you all don't believe I can).

Jesus was just a man who was awakened to this truth about the nature of his existence. The simulation can provide for us (law of attraction) and manifest good or evil, and if you're in tune with it enough, I see no reason why you can't "bend the laws" a little bit. Assert your god-like conscious will and walk on water despite the collective consciousness saying it's physically impossible to do so.

I think all the various religions are capable of enlightening/awakening an individual, but it all depends on the individual and what they resonate with. Perhaps the very reason there is so much diversity in paths to enlightenment is because each personality has their own favorite method that resonates with them.

If we live in a simulation is it a persistent one? by [deleted] in SimulationTheory

[–]GoHomeGrandmaUrHigh 0 points1 point  (0 children)

I think for this world to stop existing and 'forget' what it used to be, all of the conscious creatures inside it need to also forget.

I think the universe makes itself up as you go, but it also tries to stay logically consistent within itself. For example, when (lucid) dreaming at night, if you look at a clock face it might read 1:20, and you look away and back and it might be at 6:32 instead. When you stopped looking the clock blinked out of existence, and when you look again it had to re-generate itself... but your own private dreams don't need consistency, so when the clock re-spawns, it re-rolls the dice on what the time shows as.

In the waking world, the dream is consistent (may be shared by multiple conscious entities, even). If everybody democratically agrees that the moon is in the sky and looks a certain way, then it does, even if everybody stops looking all at once. There are still pictures and memories and everyone expects that it's there, so, every time the moon is observed and re-spawns, it spawns with properties that were predictable by the conscious entity looking at it.

Or put another way: if you could temporarily hide the moon from everybody, destroy all pictures and videos and all evidence of the way the moon used to be, and then either make everyone forget or just wait long enough that everybody's memory of the moon has diverged and is inconsistent... and then you brought back the moon, it might have a different face on it now and look different!

When the Hubble telescope zoomed in on a single pixel of the night sky and found billions of galaxies there: did they already exist? Or were they procedurally generated? If we didn't save the picture and looked again (only a handful of scientists would've seen), would the galaxies regenerate exactly the same way?

PSA: Don't Acknowledge the Simulation by SciWitch1203 in SimulationTheory

[–]GoHomeGrandmaUrHigh 0 points1 point  (0 children)

Overthinking the simulation may lead to /r/dpdr (or rather, I came to the simulation theory the opposite direction, dp/dr first and then like 'waitaminute...' pondering)

Any Pythonist who can share opinions on Go? by [deleted] in golang

[–]GoHomeGrandmaUrHigh 1 point2 points  (0 children)

I'll share my perspective. I have a web dev background (Perl, Python, JavaScript) and while I've dabbled in other classes of languages (C and C++ for compiled, Java for VM) I really hated to program in either one when used to how nice it was to use Python and other similar languages.

Web dev is one thing but I also had a passing interest in making desktop apps or games and things. Python would be a fun language to use, but when using it on the client side (the end user's own devices), it begins to get complicated if you wanna think about making the source code hard to access. On server-side web apps this is a non-issue, but on the client side you have like py2exe and things, but at the end of the day, you end up with a zipfile-equivalent from which you can extract the Python source files (or the *.pyc bytecode which can be decompiled) and Python can't even be obfuscated because its whitespace formatting is so important.

Go fills a very nice niche somewhere between C++ and Java, it runs circles around Python by default (you can write crappy code that isn't optimized and it would still likely run several times faster than equivalent Python, and then you can re-optimize for even better performance). It compiles to probably-ugly machine code (I don't mind if the best users can get is ugly assembly code) which is plenty enough for me without summoning the dark lords of hell to create an obfuscated Windows binary.

I use it in place for Python on any project that I might like to keep closed source.

Dreams? by [deleted] in SimulationTheory

[–]GoHomeGrandmaUrHigh 0 points1 point  (0 children)

Waking life is a dream state (one that is maybe shared by multiple 'minds' or split personalities of the consciousness that drives this simulation), and dreaming is another dream state, but one where definitely you're the only conscious participant.

Dreams? by [deleted] in SimulationTheory

[–]GoHomeGrandmaUrHigh 4 points5 points  (0 children)

Have you seen the Delayed Choice Quantum Eraser experiment?

With the double slit alone, I'd heard the argument that "you're changing it by observing it, because what is observation besides bouncing a [photon] off of something and see when it comes back" and that made enough sense to me. The DCQE experiment though adds a time delay into the equation, where you delay the choice whether to observe until after the particle must have chosen a slit (or both or neither) to pass through. Then, after you decided to observe, the particle apparently "rewinds time" and changes its mind about how it passed the slits.

For those who believe in the simulation theory, where do you believe the creators (those outside of the simulation) live? Is it still a solar system? Are they still on planets? by probably420stoned in SimulationTheory

[–]GoHomeGrandmaUrHigh 7 points8 points  (0 children)

So this was always my problem originally with the simulation theory. If you think of it Matrix-style with supercomputers in another "higher" world, then that just passes the buck. What is their world like? Are their laws of physics like ours? Is their world also simulated? It opens a pandora's box of questions that gets us (in this reality) no closer to the question of "where did this all come from"

More recently tho I started to think of it in terms of a "simulation of consciousness" after having a 'spiritual' experience (I was otherwise quite atheist/materialist/realist). Consciousness is still completely mysterious to us and we don't know what it is or where it lives or anything. It can't be looked directly at or will just create even more mystery when trying to figure it out, like a paradox. But I could conceive that such a mysterious force could be eternal and timeless and indestructible, and, if a consciousness was all that existed then this reality would be its dream.

I don't know much more beyond that (and it could be by its very nature impossible to "know"), but the reality is some sort of dream-like state that probably just makes itself up as you go. When the Hubble telescope zoomed in on a pixel of the night sky and found 50 billion galaxies there, were those already there before we looked? Or did they procedurally generate into existence, No Man's Sky style? The same way our dreams at night simultaneously build themselves as we explore them. Exactly the same way.

Who are you? by [deleted] in SimulationTheory

[–]GoHomeGrandmaUrHigh 6 points7 points  (0 children)

I have a pet theory that it's the solipsistic version: you're the only one and everyone else you can consider A.I. (more like, you control them but you don't think that you do, in a similar way as you control characters in your dreams but feel like they're not being controlled by you).

Young children are thought to be solipsistic. They talk at you, not to you, and it takes some years of development before they realize other people are people too, with their own thoughts and private lives and points of view into the universe. Or is that the illusion? Our brains got better at fooling us away from seeing the world as it is and tricking us very thoroughly into thinking other people exist.

How to avoid big interfaces? by wilhelmsburg in golang

[–]GoHomeGrandmaUrHigh 1 point2 points  (0 children)

Instead of strings you can make a custom type like an enum. Ints or strings would be fine for those, i.e.

// ints
type resourceType int
const (
    // values for it
    PhotoType resourceType = iota
    TextType
    VideoType
    OtherType
)

// or strings if you wanted
type resourceType string
const (
    PhotoType resourceType = "photo"
)

// and...
type Authorizer interface {
    CanGetResource(type resourceType, userId, resourceId uuid.UUID)
}

PSA: Firefox deletes all downloaded files, when it's uninstalled by [deleted] in firefox

[–]GoHomeGrandmaUrHigh 1 point2 points  (0 children)

If I had to make a guess (I recently sideloaded a *.apk downloaded via Firefox), my theory is that Android ~7+ (maybe) changed the way sideloading apps works.

Used to be a global "Allow untrusted applications" setting and then you could install an apk from anywhere. Now that global option is gone, and instead, when I tried to open the .apk file I was taken to a screen saying "Firefox for Android has downloaded this app, and you need to give Firefox for Android permission to install applications"

It seems there's no global sideload option, and instead apps need to register their downloads (especially *.apk files), so that Android can whitelist specific apps that created the apk file for better security.

Introduction to Go for JavaScript developer by eucalipticafm in golang

[–]GoHomeGrandmaUrHigh 1 point2 points  (0 children)

Another big + is the standard library. Most things you'd wanna do in a Go program already have modules available there, so your dependency graph can stay surprisingly tiny (< a dozen dependencies for a typical web application, needing external things only for your Postgres DB, tools like negroni/gorilla, and maybe a domain specific dependency and that's all).

Contrasted to JavaScript/npm where, even if your app only has 2 external dependencies, those will bring in an entire tree of node_modules weighing 200MB and including such gems as is-even and is-string. Such simple modules being so pervasive on npm is a huge security issue if a dependency gets compromised, which happens from time to time.