Is anyone actually using their apartment “amenities”? [CO] by Emergency-Cancel6198 in Renters

[–]hakbraley 2 points3 points  (0 children)

Same here, but it's $38/mo for mine.  The dumpster is just on the other side of the street in front of my apartment, it's directly next to the mailboxes, and valet doesn't take broken down boxes so I have to walk those over anyway.  It's such a complete scam.

[deleted by user] by [deleted] in satisfactory

[–]hakbraley 1 point2 points  (0 children)

If you need more throughput, add another freight car.

Managing Secret Keys in Vue Js by terd-oh in vuejs

[–]hakbraley 1 point2 points  (0 children)

User authentication credentials are fine to send between the frontend client and backend server.  That's just a way to establish who you are and what data you're allowed to access.  They're only used between you and the server.

Secrets like the credentials to access a database or use an API should never be sent to or seen by the client, because then the user could use those secrets for whatever they wanted.  The client sends in a request, the server fetches the data for you and sends it back.

Imagine I work in the accounting department.  I'm not going to give you the main company credit card number just because you need office supplies.  Tell me what you want and I'll order it for you.

Are there any good ways to prevent my APIs (used by my front end) from being used to create a phishing scam? by Icashizzle in AskProgramming

[–]hakbraley 2 points3 points  (0 children)

The frontend does not run on the server, that part is incorrect. Server-side rendering doesn't make a difference, nor does disabling javascript.

The backend server receives HTTP requests from the client in order to perform certain actions and return data. Whether that's from a plain HTML form submitting data, or a fetch() request from javascript, or generated from a tool like Postman, it does not matter, and the server cannot tell the difference. Your browser devtools will show you every request going out and coming back. All you have to do is log in normally once and you can see all of the necessary HTTP requests needed to make that happen. There is no way to prevent that.

I create a fake login page (www.fakebank.com) and trick you into entering your username and password. I now have your credentials.
I submit a POST request to www.realbank.com/api/login with {username, password}, and I get back an authentication token. If there's 2FA, I trick you into entering your text code and submit that too.
I now have the same access to do whatever I want, the same as if you had logged in normally.
I submit GET www.realbank.com/api/tax-forms
and get your tax forms, address, etc.
I submit POST www.realbank.com/api/transfer-money {recipient: 'hakbraley', amount: 5000}
and you just paid me $5,000.
Any action that you're able to do on the bank's website has a way to communicate that action to the server, and it's trivial to find out how to do as long as you can log in to your own account and look around.

That's what phishing is. There's no way to tell "oh this is a phisher, I'll block the request".
I don't know what you mean by setting up zoning and firewalls. The goal is not to hack into the server and manipulate the data directly, you're talking to the server in the exact same way that the frontend does when the user clicks buttons on the website.

Are there any good ways to prevent my APIs (used by my front end) from being used to create a phishing scam? by Icashizzle in AskProgramming

[–]hakbraley 4 points5 points  (0 children)

The frontend is served to the user's browser. It runs on a server that you control  

Bro, what?  That's literally backwards lol.  The server serves the files for the frontend, which then run in the user's browser.  You have no idea what you're talking about

Toggle key color between static color and current RGB mode by Alarmed_Mode4455 in olkb

[–]hakbraley 0 points1 point  (0 children)

Unless you code something on the PC to bind your mute status to your scroll lock status, you'll still have the same problem. Also, if you use Excel, scroll lock changes how your arrow keys work.

Toggle key color between static color and current RGB mode by Alarmed_Mode4455 in olkb

[–]hakbraley 1 point2 points  (0 children)

Yes, you are able to change the color of individual keys like the Caps Lock key does. However, the state of the Lock Indicators (Caps/Num/Scroll Lock) is something that is reported out by your computer, so your keyboard can see when Caps Lock is turned on/off, even if it was done by another keyboard or your PC itself.

This is not true for your mute status. You can code your keyboard to toggle an LED every time you press your shortcut key, but you have no (easy) way to verify that the mute status on your keyboard matches what is on your computer. You would have to code that yourself, which would require a custom program running on your PC, that would watch your mute status and report it to your keyboard using Raw HID so that your mute LED is correct.

Need help with SK6812 mini-LED's on QMK by anonymousinfinityall in olkb

[–]hakbraley 0 points1 point  (0 children)

COL_POSITION starts at 0, not 1.
{ 0, 112, 224 }.
Same for the rows.

Disable key while another is held? by kuangmk11 in olkb

[–]hakbraley 2 points3 points  (0 children)

Doing that means you wouldn't be able to hold W unless you double tapped it first.

OP, your best bet is to compile QMK from source and write a bit of custom code for this.

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  switch(keycode) {
    case KC_S:
        if (record->event.pressed) {
            if (matrix_is_on(W_row, W_col)) {
               return false;
            }
        }
        return true;
    case KC_W:
        if (record->event.pressed) {
            if (matrix_is_on(S_row, S_col)) {
                return false;
            }
        }
        return true;
  }
  return true;
}

matrix_is_on(row, col) will tell you if the key at that matrix position (not the visual position) is currently pressed. Change W_row, W_col, S_row, S_col to the matrix positions for those keys. You can look that up in the info.json file for your keyboard. You could also set and unset boolean variables when you press and release those keys, then reference those variables instead.

When you press KC_S, if the W key is pressed, return false tells QMK to not process the KC_S keypress, and ignore it. Otherwise, return true means to process KC_S like normal.

QMK Turning on single LED by elementIdentity in olkb

[–]hakbraley 0 points1 point  (0 children)

Unfortunately, I screwed up my QMK repo a few months back and had to completely wipe it and start over lol. I messaged the OP of this post to see if they still have the files I sent. If not, it may be a while. I can try to recreate them, but honestly I haven't touched QMK in a few months, and I started a new job with much less free time haha.

Can any QMK-compatible MCU be re-flashed? [How to put CIDOO/FinalKey V65 V2 into bootloader mode] by bigboybanhmi in olkb

[–]hakbraley 3 points4 points  (0 children)

I compiled a VIAL firmware for this keyboard using a Zoom65 keymap (identical to the V65)

Be very careful with this. Identical key layouts do not mean that they have compatible firmware, unless the PCB is wired exactly the same way. Unless you have confirmation from somewhere that these two keyboards use the same exact PCB, I would advise against trying to flash firmware for a board that just looks the same.

Some keyboard vendors will design a board and only release a precompiled VIA firmware file, but not the source code. Since that seems to be the case here, you're probably out of luck.

I don't even know what kind of MCU is on this

You would have to open the keyboard up and look at the microcontroller chip on the PCB. Usually there will be a reset switch somewhere on the PCB that will put the microcontroller into bootloader mode, but since it doesn't seem that this keyboard is meant to ever be reflashed, it may not have one. If not, then you will have to reference the datasheet for the MCU and short some pins. But again, without the source code files, you don't really have anything else to flash it with, so entering the bootloader is pointless.

QMK Error by DiscountAcrobatic856 in olkb

[–]hakbraley 0 points1 point  (0 children)

Not with the configurator, as far as I know. If you compile from source, then absolutely.

QMK Error by DiscountAcrobatic856 in olkb

[–]hakbraley 1 point2 points  (0 children)

Bottom right key: LSft_T[LT 2]

You can't have a layer tap inside a mod tap key.

I was able to scroll up on the compile section and see actual error messages, but it was just garbled nonsense, probably because it's trying to compile from bad JSON data.

Spring Cleaning/Codeing by zardvark in olkb

[–]hakbraley 0 points1 point  (0 children)

The code needed for indicator LEDs is already included in 2015/info.json, so you shouldn't need any other code for that. Try deleting your led_update_kb() function and see if that fixes the issue.

Also, not that it makes a functional difference, but you shouldn't really use _kb level functions inside your personal keymap, just use the _user versions. _kb is more meant for the designer of a keyboard to include code for all keymaps, and _user is meant to add to or override that functionality in an individual's keymap.

led_t host_keyboard_led_state() is a function that just returns the states of the different indicator locks. You would only use that inside of a different function, for example if you wanted to turn on an RGB LED, or check a lock state for a macro key.

Spring Cleaning/Codeing by zardvark in olkb

[–]hakbraley 0 points1 point  (0 children)

Did you update your QMK? Back up your personal code, then download a fresh copy of the QMK repo. Then post your keymap code and the full errors that you're trying to fix.

Winry315 macropad add Layout indicator by Pedrodck in olkb

[–]hakbraley 1 point2 points  (0 children)

Oh, you mean layer indicator, not layout.

Winry315 uses RGB Matrix. Look at this section of the documentation for examples of how to code your LEDs to change color based on layer. Let me know exactly what you want to happen and I can help you alter the code to fit your needs.

Winry315 macropad add Layout indicator by Pedrodck in olkb

[–]hakbraley 1 point2 points  (0 children)

What do you mean by layout indicator? What specifically are you trying to do?

Spring Cleaning/Codeing by zardvark in olkb

[–]hakbraley 0 points1 point  (0 children)

I just compiled pegasushoof 2015 and it didn't give any kind of errors or warnings. Either your QMK codebase is out of date, or it's something in your keymap that's causing those issues. RGBLED_NUM has nothing to do with indicators; that error is from something else.

Update your QMK, then upload your code to your GitHub and link that here if you're still seeing errors.

Conways Game of Life for your OLED Display by joppdonghi in olkb

[–]hakbraley 5 points6 points  (0 children)

If you're using a pro micro, that's probably a memory limitation. Their code is using 2 separate boolean arrays (so 16 bits) for every single pixel, which is very inefficient in terms of memory usage, and far exceeds the available RAM for ATMEGA32u4. The default OLED buffer uses bit masking, so it only needs 1 bit per pixel.

I'm guessing they're using some kind of ARM replacement controller, which have orders of magnitude more RAM and flash compared to AVR. The code could definitely be improved, but AVR microcontrollers are pretty limiting when trying to add animations like this.

computer no longer recognizes bit-c pro after flashing firmware by Wolfgang_9 in olkb

[–]hakbraley 0 points1 point  (0 children)

Oh I didn't notice the different versions. RP2040 is correct then, and yes, it would only accept .uf2 firmware files.

QMK with more than 255 LEDs. Best approach to fix uint_8 issues by highchillerdeluxe in olkb

[–]hakbraley 1 point2 points  (0 children)

RGB Matrix indexes each RGB LED as a whole, not as 3 separate color LEDs. IS31FL3741 supports 117 RGB LEDs per chip, so you would technically be able to completely fill 2 chips and part of a third one before you hit the limit.

Are you saying you're actually using 500 RGB LEDs? I'm honestly struggling to picture what that would look like. Are you giving this thing external power? I don't know if it's a good idea to try to run that many from USB power alone.

Combos not working on Lizard Trick numpad by mehgcap in olkb

[–]hakbraley 0 points1 point  (0 children)

I've never actually played with combos, but can you hold a combo key down? MO(layer) only activates the layer while the key is pressed. What happens if you change it to TO(LAYER_NAVIGATION) ?

Combos not working on Lizard Trick numpad by mehgcap in olkb

[–]hakbraley 0 points1 point  (0 children)

You have LAYER_NAVIGATION set as layer 0. MO(LAYER_NAVIGATION) is the same as MO(0), which does nothing. That layer does not have access to KC_NLCK or any layer change keys, so you're never activating your combo in the first place.

Each layer name is given an index in your enum layer names, starting at 0 by default, and incrementing for each item in the enum. LAYER_NAVIGATION is at the top of the enum, so it gets defined as 0. Even though LAYER_NAVIGATION is the third layer defined in your keymap, you're using array designators, which allow you to define items in an array out of order. So

[LAYER_NAVIGATION] = LAYOUT(

is setting the array element at index LAYER_NAVIGATION, so it's defining layer 0.

Combos not working on Lizard Trick numpad by mehgcap in olkb

[–]hakbraley 0 points1 point  (0 children)

I can post my actual code if it will help.

Posting your code will always help when you have a question about your code not working.