Karyoplasma
- 0 Posts
- 778 Comments
Karyoplasma@discuss.tchncs.deto Programmer Humor@programming.dev•Yes, I did spend time on this7·17 hours agoYes, it’s easy to understand, but this ifelse is much safer because it “handles” uppercase and digits by just returning 0. If you’d call OP’s function with something like ‘A’, you’ll get nonsense data because it doesn’t have a default. (I think it will return whatever value currently resides in eax)
Karyoplasma@discuss.tchncs.deto World News@lemmy.world•Trump and Putin both agree: Blame falls on Europe as Ukraine peace effort languishesEnglish171·2 days agoTo be fair, I blame the compiler as well when the shit I write doesn’t work.
Film fängt an. Pause drücken, muss auf’s Klo.
Karyoplasma@discuss.tchncs.deto Technology@lemmy.world•Meta’s AI Profiles Are Already Polluting Instagram and Facebook With SlopEnglish19·8 months agoYou cannot really pollute these platforms any more than they already are imo. The AI slop perfectly resonates with the rest of the garbage there, so it shouldn’t make a difference.
Karyoplasma@discuss.tchncs.deto Comic Strips@lemmy.world•Another orbit around the sun152·8 months agoNew Year’s is my favorite holiday. Just gonna chill with a friend with beer, crackers and some chess/video games. My Christmas present from my dad was to go buy some fireworks with him, so I got a bunch of stuff to do at midnight.
Way better than Christmas or Easter or other baloney festivities. New Year’s is at least somewhat tangible even tho I do concede, it makes no difference.
“Not for consumption?” Don’t you tell me what to do, I’ll eat what I want!
Karyoplasma@discuss.tchncs.deto Privacy@lemmy.ml•What is your private way of watching YouTube videos when Invidious or Piped are not working?2·8 months agoI wrote myself a Chrome add-on that adds a context menu entry to play or download links.
background.js
chrome.runtime.onInstalled.addListener(() => { chrome.contextMenus.create({ id: "processLink", title: "Download as...", contexts: ["link"] }); chrome.contextMenus.create({ id: "720p", parentId: "processLink", title: "720p", contexts: ["link"] }); chrome.contextMenus.create({ id: "music", parentId: "processLink", title: "MP3", contexts: ["link"] }); chrome.contextMenus.create({ id: "maxQual", parentId: "processLink", title: "Maximum quality video", contexts: ["link"] }); chrome.contextMenus.create({ id: "separator1", parentId: "processLink", type: "separator", contexts: ["link"] }); chrome.contextMenus.create({ id: "piQual", parentId: "processLink", title: "30 fps for RPi", contexts: ["link"] }); chrome.contextMenus.create({ id: "separator2", parentId: "processLink", type: "separator", contexts: ["link"] }); chrome.contextMenus.create({ id: "streamLink", parentId: "processLink", title: "Stream to VLC...", contexts: ["link"] }); }); chrome.contextMenus.onClicked.addListener((info, tab) => { let linkUrl = info.linkUrl; if (info.menuItemId === "720p") { sendLinkToNativeApp(linkUrl, "video720"); } else if (info.menuItemId === "music") { sendLinkToNativeApp(linkUrl, "music"); } else if (info.menuItemId === "maxQual") { sendLinkToNativeApp(linkUrl, "videomp4"); } else if (info.menuItemId === "piQual") { sendLinkToNativeApp(linkUrl, "video720p30"); } else if (info.menuItemId === "streamLink") { sendLinkToNativeApp(linkUrl, "stream"); } }); function sendLinkToNativeApp(link, action) { console.log("Sending link to native app with action:", action, link); chrome.runtime.sendNativeMessage( 'com.example.ytlink_processor', { link: link, action: action }, function(response) { if (chrome.runtime.lastError) { console.error("Error:", chrome.runtime.lastError.message); } else { console.log("Received response from native app:", response.output); } } ); }
native_host.py (chatGPT wrote this because I can't Python)
import sys import subprocess import json import struct def log_to_file(message): with open("log.txt", "a") as log_file: log_file.write(message + "\n") def get_message(): raw_length = sys.stdin.read(4) if len(raw_length) == 0: sys.exit(0) message_length = struct.unpack('I', raw_length)[0] message = sys.stdin.read(message_length) return json.loads(message) def send_message(message_content): message = json.dumps(message_content) sys.stdout.write(struct.pack('I', len(message))) sys.stdout.write(message) sys.stdout.flush() def process_link(link, action): if action == "stream": cmd = 'yt-dlp --stream "{}" -o - | "D:/Programme/VLC/vlc.exe" -'.format(link) else: cmd = 'yt-dlp --{} "{}"'.format(action, link) result = subprocess.Popen('start cmd /c "{}"'.format(cmd), shell=True) return result.stdout + result.stderr if __name__ == "__main__": message = get_message() link = message.get("link") action = message.get("action") if link and action: output = process_link(link, action) send_message({"output": output})
The actions are just aliases for different qualities (old pi, so 720p60 stutters at times), audio extraction, etc.
Karyoplasma@discuss.tchncs.deto Privacy@lemmy.ml•What is your private way of watching YouTube videos when Invidious or Piped are not working?2·8 months agoAwesome, works with VLC as well. Thanks.
Karyoplasma@discuss.tchncs.deto Technology@lemmy.world•Insiders say cutting-edge graphics are too costly for AAA gamesEnglish2·8 months agoTAA, motion blur, depth of field. Why do “technologies” to turn a good looking game into a trash looking game even exist?
Karyoplasma@discuss.tchncs.deto Privacy@lemmy.ml•What is your private way of watching YouTube videos when Invidious or Piped are not working?7·8 months agoDownside is that you’ll have to regularly delete all the videos you’ve downloaded.
Karyoplasma@discuss.tchncs.deto Technology@lemmy.world•YouTube is cracking down on clickbaitEnglish1081·9 months agoYouTube will never “crack down” on these guys. They are their money-makes and can do whatever the fuck the want. Clickbait on huge channels is YouTube’s bread and butter, even if people just click to comment that the creator sucks, that’s still engagement and means there is more money in the ad bids.
Karyoplasma@discuss.tchncs.deto Technology@lemmy.world•PayPal Honey steals affiliate links and lies about finding the best couponsEnglish8·9 months agoI am so disconnected from this influencer thing that I first heard about Honey when news were pushing that it was a scam. I’m just living under a rock and sometimes that saves my butt, I guess.
If you don’t see a difference, you are already very close to the optimal correction and a subtle change in either direction is unnecessary. They will still go ahead and try fine-tuning the prescription and when you tell them that A and B are the same, they can fall back when they add another correction. A and B might currently be the same, but if you add C, A+C could be better than B+C.
Karyoplasma@discuss.tchncs.deto Mildly Infuriating@lemmy.world•Justice should be equalEnglish743·9 months agoMy personal tinfoil hat is that they are seeking the death penalty so he accepts a deal. They are scared of jury nullification.
China is it the enviable position of not having to pretend that Trump is good for anything. He is a bad choice for a president, so why would anyone be afraid.
Edit: well, ok Ukraine and by extension Europe should be afraid or at least concerned. I would shit myself if I were a US citizen that is not a millionaire or wealthier tho.
Karyoplasma@discuss.tchncs.deto World News@lemmy.world•Outrage as Elon Musk claims ‘only AfD can save Germany’English110·9 months agoAn apartheid-loving nazi calls for the nazi party to be the savior of Germany? Never would I have guessed.
The information, I as a not very politically interested German (understatement) have: We are holding re-elections on Feburary 23rd because the current government imploded. Basically, the rich guys’ party doesn’t want to make rich guys pay taxes and being children about it, most other parties seem desperate at this point, else they wouldn’t have challenged that much. They have never cared that much, so I have no idea what changed. The populist nazi party Musk cheers for has a lot traction because people are beyond stupid and self-centered and I fear that they will get a significant amount of votes. Maybe they don’t win outright, but they will realistically take second place. I regard everyone that considers to vote for AfD as a nazi.
Karyoplasma@discuss.tchncs.deto Lemmy Shitpost@lemmy.world•Improve your Wi-Fi with this one trick2·9 months agoBuild your own fan out of bananas and you have a radiation fan.
This is how Son Goku got his ass-pull zenkai boost on Namek.
ok, ass: wiped X was funny