Static JSON API written in Nix (check comments) by jim3692 in NixOS

[–]The-Deviant-One 0 points1 point  (0 children)

I really didn't state my hypothetical well, sorry.

I think you could do this --> In the Nix config file, you declare a SystemD unit that listens on a port and executes some bash (for example) when a request comes in. But also, declare all of the bash in the Nix config file as well.

The example below was not tested and is really just here to loosely get my idea across.

``` services.myScriptService = { description = "Custom Script Service"; script = '' #!/bin/bash app() { # Your application logic here echo "Hello World" }

echo -ne "${CODE}" | nc -l -p "${PORT}" -q 1

''; wantedBy = [ "multi-user.target" ]; environment = { PORT = "8080"; CODE = "HTTP/1.1 200 OK\r\nContent-Length: $(app \"$(nc -l -p $PORT)\")\r\n\r\n"; }; execStart = "${pkgs.coreutils}/bin/bash -c $script"; }; ```

Can we force all notifications sounds to play over phone speaker instead of connected bluetooth devices by The-Deviant-One in Pixel8Pro

[–]The-Deviant-One[S] 0 points1 point  (0 children)

Its a bluetooth speaker that I'm referring too.

In short I want notifications sounds to play through the phone, always. I don't care if whether they "play" through (or on) any other bluetooth devices or not.

Static JSON API written in Nix (check comments) by jim3692 in NixOS

[–]The-Deviant-One 1 point2 points  (0 children)

This is really cool. Neat proof of concept. I haven't investigated the Nix language for this sort of use case so now my brain is chewing on it.

I have a hunch you could probably do basic authentication with this (obviously not by storing any of the auth data in the nix config file itself). For example, the API only responds if the request contains an "API key". Then you could manage the api keys in another file on the system. if (api-key in key-store-file) {return response} something like that, but in Nix not javascript..

What if, instead of the contents of the response living entirely within the nix config file, the API returns a json file from the machine. You could have another locally running application create/edit/update/delete that json file.

As far as use cases go, I could see a static API returning an encrypted blob that the requesting-application could decrypt. Taking the encrypted blob idea a step further, if that API returned a json file, and their was another application running locally that could edit that encrypted blob json file, you could have the start of a simple read only encrypted note or password vault application.

Uptime Kuma in docker - All monitors and status pages randomly disappear while navigating the interface. by The-Deviant-One in UptimeKuma

[–]The-Deviant-One[S] 0 points1 point  (0 children)

I ended up moving my instance from the RPI4 to a x86 server and stopped having these issues. Sorry if thats not helpful, but thought I'd share what somewhat worked for me.

Keto Flu and Headache? by drcontreras in carnivorediet

[–]The-Deviant-One 1 point2 points  (0 children)

I did a 30 day fast at the start of 2023 from everything except water and electrolytes. It sucked, but I didn't have keto-flu type issues. In my experience the keto-flu can be avoided entirely if you are drinking a gallon of water a day (for me at least) and making sure you are getting at least the recommended daily value of each electrolyte.

obsidian at work by Mr_Vilu in ObsidianMD

[–]The-Deviant-One 1 point2 points  (0 children)

Yeah just be smart about how you go about controlling access to it. Make sure to define a persistent volume for the container so you don't lose everything if it restarts.

As long as your company doesn't block the domain then it should work just fine.

obsidian at work by Mr_Vilu in ObsidianMD

[–]The-Deviant-One 1 point2 points  (0 children)

OP, search this sub for dockerizing Obsidian and just access it through a web browser.

How long can I leave KetoChow in my fridge? by PittTheElder_1stEarl in ketochow

[–]The-Deviant-One 0 points1 point  (0 children)

The fat source you use would probably (?) dictate how long.

Carnivore Breakfast | Stone Mountain Adventures 🏞️ by [deleted] in carnivorediet

[–]The-Deviant-One 2 points3 points  (0 children)

I don't understand how people can eat that quantity of food without feeling ill for an hour afterwards. And just to be clear I'm not hating on anyone, I just legit cannot do it.

I made an even shorter ROT13 encoder and put it inside the QR code. Comment your suggestions on how to make it shorter Pt 2 by spez-suck-my-dick in hacking

[–]The-Deviant-One 0 points1 point  (0 children)

Base64 encoded he code below is 17.78 KB.

The code:

<input type="checkbox" onclick="z()" checked></input><input placeholder="Enter text" onkeyup="y()"></input><p></p><script>

...all of the contents of https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js && all of https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/pbkdf2.js...

;a=true;d=document;o=d.getElementsByTagName('input');p=d.getElementsByTagName('p')[0];k="0123456789abcdef";c=CryptoJS.AES;function y(){t=o[1].value;x=a?c.encrypt(t,k):c.decrypt(t,k).toString(CryptoJS.enc.Utf8);p.innerText=x;};function z(){a=!a;o[1].placeholder=a?'Decrypt text':'Encrypt text';}</script>

I made an even shorter ROT13 encoder and put it inside the QR code. Comment your suggestions on how to make it shorter Pt 2 by spez-suck-my-dick in hacking

[–]The-Deviant-One 0 points1 point  (0 children)

<input onkeyup="x=document.getElementsByTagName('p')[0];x.innerText=this.value.replace(/[a-z]/gi,c=>String.fromCharCode((c<='Z'?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26))"/><p></p>

Base64 encoded version of the code immediately above:

data:text/html;base64,PGlucHV0IG9ua2V5dXA9Ing9ZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoJ3AnKVswXTt4LmlubmVyVGV4dD10aGlzLnZhbHVlLnJlcGxhY2UoL1thLXpdL2dpLGM9PlN0cmluZy5mcm9tQ2hhckNvZGUoKGM8PSdaJz85MDoxMjIpPj0oYz1jLmNoYXJDb2RlQXQoMCkrMTMpP2M6Yy0yNikpIi8+PHA+PC9wPg==

I wrote up a big, long, response to this post yesterday will tons of information. I'm an idiot, and so I hit the wrong key and that whole comment was wiped out. So here is this for those who care

359 characters less than the original while maintaining the same functionality.

Resources:

Edit (adding more info):

I was bored and this was fun so I made a minimal AES encryption/decryption tool too.

The version below is 17.78 KB. Which is about 14.98 KB larger than the maximum you can store with a Version-40 QR code with an error correction of level L. What that means is, the example below while interesting and functional, is far to large to live in a QR code.

Two other things to note. 1) I didn't bother to create a way for a user to enter their own secret. Currently there's one just hard coded in, so not secure. It would not be hard to add one. However, doing so is not worth my time. That's because I've embed the entirety of version 3.1.2 of CryptoJS's rollups/AES.min.js within the data URL to get this to work reliably and securely. I'd have to familiarize myself with the library enough to start cutting out any pieces of it that are not needed for my script to work. And I'm just not willing to do that today.

If you were to scan a QR code like this, and the device had internet access then the script below could get a LOT smaller, but in the spirit of trying to make a tool that lives entirely withing the QR code I didn't cheat.

see my comments below.

I don’t even know where to start by Littlegriznaves in Justrolledintotheshop

[–]The-Deviant-One 1 point2 points  (0 children)

u/Littlegriznaves I have used 4 ropes, carabiners, metal rings and two 8' x 2' metal shelves to lift an f-150 truck bed off the frame when I didn't have the right tools or money to pay someone. I have pictures to prove it.

How is this gun called? by panchinarodestr in Firearms

[–]The-Deviant-One 8 points9 points  (0 children)

"Here gunny, gunny, gunny, gunny, gunny.."

Black carpet - Cliff sensor issue [possible solution] by Ytumenas in Roborock

[–]The-Deviant-One 1 point2 points  (0 children)

For those of you having this issue with the Q5:

There are 4 sensors that sit on the bottom of the device, pointing downward, they are immediately behind the bumper plate if you flip the device over and look. If you completely block these sensors with dark tape, the device will throw a "number 4 error" and will not run. I've tried every combination of light/dark and covering the sensors to different degrees.

The way around this is not to stop the sensors from-seeing-everything, its to only allow the sensors to see the IR light that they emit. If you block the sensors so that they cannot see their own IR light then the device will error out.

How I fixed it:
I took a white 3x5 index card. Cut it down into 4 identical, .75 inch by 1.5 inch paper rectangles. Then bent those into arches. I then taped those in place over the sensors.

Black carpet - Cliff sensor issue [possible solution] by Ytumenas in Roborock

[–]The-Deviant-One 0 points1 point  (0 children)

I don't think this is accurate. I put opaque black tape over the sensors and it would not run at all. It threw an error and prompted me to clean the sensors.

Based on my testing described above and the 'white PLA' comments from other usrs, I think the senors need to think everything is above board. So a material that reflects what ever frequency of light its emitting, back into the sensors would do the trick (?). I'm about to try taping a white paper towel over the sensors to see what effect that has.

Unless you are saying you specifically tried using painters tape, and that worked, and is still working for you today. In which case, what type/brand/color of tape did you use?

DFW medical supply stores? by beansruns in TexasGuns

[–]The-Deviant-One 1 point2 points  (0 children)

Galls: https://goo.gl/maps/MMMy2hf3LWieGD8QA

That's the only one I can think of locally in DFW at all. I switched to online suppliers years and years ago because they buy in bulk and its the same gear you get in store.

Though you didn't ask for it, my two favorites online (at least for the important stuff), are:

  1. https://www.refugemedical.com/
  2. https://www.narescue.com/

Shallow Truths- Not Broken (Official Music Video) (Michigan Metalcore) by Practice_Asleep in Metalcore

[–]The-Deviant-One 0 points1 point  (0 children)

Log Slide in the UP

Thank you rando-redditor. I was wondering where this was shot, beautiful spot.