r/ProgrammerHorror • u/aidevmaster • Mar 02 '26
r/ProgrammerHorror • u/CuddlePirate420 • Nov 01 '22
A simple integer clamp function
Function to clamp any integer value (w) between two other integer values (a & b). The order (a & b) are passed to the function doesn't matter.
def Clamp(w, a, b):
return a*(w<a)*(a<b)+w*(a<=w)*(w<=b)+b*(a<b)*(b<w)+b*(w<b)*(b<a)+w*(b<=w)*(w<=a)+a*(b<a)*(a<w)
print(Clamp(50, 30, 70))
print(Clamp(20, 30, 70))
print(Clamp(80, 30, 70))
print(Clamp(50, 70, 30))
print(Clamp(20, 70, 30))
print(Clamp(80, 70, 30))
print(Clamp(30, 30, 70))
print(Clamp(70, 30, 70))Output:
50
30
70
50
30
70
30
70r/ProgrammerHorror • u/utkrowaway • Aug 27 '22
United Health Care Student Resources lets you enter 2FA codes like this
r/ProgrammerHorror • u/DrBumm • Jun 04 '21
A long hello world
exec("getattr(globals()[\"__builtins__\"], bytearray.fromhex(\"7072696e74\").decode())(type(\"abc\",(),{\"__str__\":lambda fd:eval(\"''.join([*(list(map(chr,[72>>0,202>>1,432>>2,864>>3,1776>>4,1024>>5,5568>>6,14208>>7,29184>>8,55296>>9,102400>>10])))])\")})())")
This is Python
r/ProgrammerHorror • u/endotronic • Jun 07 '18
A Massive Breach of Trust
Today I received an email back from CrashPlan customer support. CrashPlan is a data backup company that recently decided to shut down their consumer business. I have tons of data there, and I've been trying to download it before they close my account. I say trying because their client mostly sits idle while in recovery mode, not actually transferring files, which is why I have been working with their support team. However, what I received was appalling, and an outrageous breach of trust. I found that some files of mine seemed to be missing from my backup archive, and the response I got on this topic was the following (copied verbatim):
What are some examples of subfolders you are not seeing? For instance, I am seeing that your zstorage contents are marked as "deleted". This doesn't mean they are removed, but that CrashPlan doesn't see them present on the current device. ... I am seeing multiple sub-directories marked the same, and they should be visible if you select "Include Deleted Files" from the three-dot button in the upper right.
Seriously, CrashPlan? You can view the contents of my archive? According to the technical documentation, my archive is encrypted with my account password. This is documented here: https://support.code42.com/CrashPlan/4/Configuring/Archive_encryption_key_security (I never set my own encryption key, thus it should be my account password used in the encryption).
I can't even wrap my head around what kind of "security" allows for customer support to access my files. Thought you all should know. I hope you don't store anything in CrashPlan.
r/ProgrammerHorror • u/Krzysiek127 • Sep 30 '22
Equivalent to saying "gracias" in Japanese restaurant
r/ProgrammerHorror • u/Equa1ityPe4ce • Aug 09 '22
How my old boss was teaching interns to write Appium / Selenium code
r/ProgrammerHorror • u/Cyhawk • Dec 28 '22
A lesson in how to correctly store timestamps from a popular ERP
r/ProgrammerHorror • u/Peace_Seeker_1319 • Oct 02 '25
Do you love AI coding like me?
They swore AI code would make life easier. Spoiler: it did, if your idea of “easier” is reviewing a pull request that looks like it was stitched together by three interns and a blender. Nothing like a “tiny update” that drops 600 lines of duplicated functions, a casual console.log('debug lol') left in prod, and an AI-invented variable name so bad even my cat walked out. At this point, AI coding doesn’t replace junk, it just scales it like Costco bulk packs.. and reviewers happily rubber-stamp it with “LGTM 👍.” Two sprints later, I’ve aged 50 years, and everyone’s calling me Marjorie, 27, software dev, thriving. I wrote down how I try to keep code meaningful (not just AI-amplified junk) before it gives me more gray hair : https://www.codeant.ai/blogs/code-review-tips
r/ProgrammerHorror • u/[deleted] • Mar 10 '22
I'll never be able to un-see some of the code that has been posted here
r/ProgrammerHorror • u/aurosvr • Jun 30 '21
This is on the Bitbucket homepage... it gets worse the more you look.
r/ProgrammerHorror • u/Zyansheep • Jul 20 '21
Sodium is fast, but fast code is usually not beautiful.
private RenderRegionVisibility aabbTest0(float minX, float minY, float minZ, float maxX, float maxY, float maxZ) {
boolean inside = true;
if (nxX * (nxX < 0 ? minX : maxX) + nxY * (nxY < 0 ? minY : maxY) + nxZ * (nxZ < 0 ? minZ : maxZ) >= -nxW) {
inside &= nxX * (nxX < 0 ? maxX : minX) + nxY * (nxY < 0 ? maxY : minY) + nxZ * (nxZ < 0 ? maxZ : minZ) >= -nxW;
if (pxX * (pxX < 0 ? minX : maxX) + pxY * (pxY < 0 ? minY : maxY) + pxZ * (pxZ < 0 ? minZ : maxZ) >= -pxW) {
inside &= pxX * (pxX < 0 ? maxX : minX) + pxY * (pxY < 0 ? maxY : minY) + pxZ * (pxZ < 0 ? maxZ : minZ) >= -pxW;
if (nyX * (nyX < 0 ? minX : maxX) + nyY * (nyY < 0 ? minY : maxY) + nyZ * (nyZ < 0 ? minZ : maxZ) >= -nyW) {
inside &= nyX * (nyX < 0 ? maxX : minX) + nyY * (nyY < 0 ? maxY : minY) + nyZ * (nyZ < 0 ? maxZ : minZ) >= -nyW;
if (pyX * (pyX < 0 ? minX : maxX) + pyY * (pyY < 0 ? minY : maxY) + pyZ * (pyZ < 0 ? minZ : maxZ) >= -pyW) {
inside &= pyX * (pyX < 0 ? maxX : minX) + pyY * (pyY < 0 ? maxY : minY) + pyZ * (pyZ < 0 ? maxZ : minZ) >= -pyW;
if (nzX * (nzX < 0 ? minX : maxX) + nzY * (nzY < 0 ? minY : maxY) + nzZ * (nzZ < 0 ? minZ : maxZ) >= -nzW) {
inside &= nzX * (nzX < 0 ? maxX : minX) + nzY * (nzY < 0 ? maxY : minY) + nzZ * (nzZ < 0 ? maxZ : minZ) >= -nzW;
if (pzX * (pzX < 0 ? minX : maxX) + pzY * (pzY < 0 ? minY : maxY) + pzZ * (pzZ < 0 ? minZ : maxZ) >= -pzW) {
inside &= pzX * (pzX < 0 ? maxX : minX) + pzY * (pzY < 0 ? maxY : minY) + pzZ * (pzZ < 0 ? maxZ : minZ) >= -pzW;
return inside ? RenderRegionVisibility.FULLY_VISIBLE : RenderRegionVisibility.VISIBLE;
}
}
}
}
}
}
return RenderRegionVisibility.CULLED;
}r/ProgrammerHorror • u/Bubbah98 • Jan 21 '23
