Hacker Newsnew | past | comments | ask | show | jobs | submit | EvilTerran's commentslogin

Same!

I also enjoy reading SciPy as "skippy".


Back when I played Minecraft, I wrote one I was pretty pleased with:

If you have a stack of items, you can pick up half of them by right-clicking on it, which is very convenient when you're dividing out a stack on the crafting grid to make many copies of a recipe that needs that item in 2 or 4 slots; but for some recipes, you need to put the same item in 3 or 6 slots, and there's no built-in way to divide a stack into thirds.

So I made an AHK script that, when I held down a key, would

- pick up half of the items in the stack I'm pointing at (right-click) - move the mouse one inventory space to the right - put them down (left-click) - pick up half of them again - move back one inventory space left - put them down, adding them back to the original stack - and repeat

and it would only stop after one of the "pick up" steps; so, after a few iterations, you'd be left with the stack divided into equal thirds, two in your inventory & one on the mouse.

Eg, starting with a stack of 60, it goes 30/30, 45/15, 22/38, 41/19, 20/40, 40/20, 20/40, 40/20... then release the key, and you've got three stacks of 20.


If I remember right: Last time I played Minecraft you took the whole stack of materials and painted (left drag) over the grid where you want the items. It would share up the stack evenly over all the grid items no matter how many you painted. Very easy to make stairs for example. I think there is an even easier way now but haven't played for a couple of versions.


I have an adjacent, simple scripting story.

Battlefield 2042 recently had an XP glitch where you could go into a server with BF3 settings, throw ammo to a teammate and get XP for the resupply. Naturally there were several servers dedicated to this with 128/128 players and everyone on one team all standing at one objective.

Rather than actually play the game to level up and get the weapons/gadgets I wanted or even play this accelerated XP mini game, I wrote an ahk script to automate the equipping and dropping of the ammo crate so that I could do other things.

I only had to let it run for a few hours before I was max level, and the 10 minutes of scripting gave me the benefit for something I wouldn’t otherwise subject myself to.


Others have already mentioned that you can replace "for (const k in props) elem[k] = props[k]" with "Object.assign(elem, props)"; further to that, in modern browsers, you can replace "for (const kid of kids) elem.appendChild(kid)" with just "elem.append(...kids)" - with the added benefit that plain strings passed to .append() get turned into text nodes automatically, so you probably wouldn't need $T any more:

https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/...


Yeah, this evolved in my head from an early version that had to support IE, so it turns out there’s a bunch of cruft in it that I hadn’t realized wasn’t necessary any more. pcr910303 posted a version which uses the same APIs you mentioned, and I think I’m going to use that one in the future.


I guess you could send changes to the DB on-the-fly inside a transaction, so when the user clicks "save" it's just a matter of running COMMIT? Not sure what effect that would have on performance as the transaction grows, though.


I believe you're thinking of the "Facebook Container" addon - it's "official", in that it's made by people at Mozilla & has their corporate blessing, but it's not installed by default.

AIUI, the only "container" functionality built-in to the browser is... infrastructure, I guess you'd call it: Firefox provides all the tools for addons to do stuff with containers, but doesn't actually do anything with them itself.


Could you not use permissions.request() [0] to ask for access to a given site on-the-fly, when the user actually visits it? That seems to be how, for example, Reddit Enhancement Suite goes about getting perms for all the various sites it supports embedding content from (imgur, twitter etc) - you get a prompt when you click to open an embed for a site you haven't granted the permission for already.

[0] https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/Web...


Please respond to the strongest plausible interpretation of what someone says, not a weaker one that's easier to criticize.

https://news.ycombinator.com/newsguidelines.html


It was a response to their main point, but the subtlety was lost on people who don't think critically.

Just because you see or don't see attacks doesn't mean you are more or less secure. It just means you've finally noticed there is risk. It doesn't mean there is more or less risk. It's the same risk, it's just more visible.


I find PCRE's rule easy enough: for a character you want to be taken literally, if it's punctuation backslash it, if it's not then don't; any unbackslashed punctuation (or backslashed non-punctuation) may be a metacharacter.

Compare to, say, POSIX or Vim[0] REs, where some punctuation characters are special with a backslash, others are special without, and I can never remember which is which.

[0] Regardless of the state of the "magic" option - the only way to get consistent behavior is to start every single RE with either \v (which works like PCRE) or \V (which works like your proposal).


> For instance most spray cleaners come in bottles made of high-density polyethylene, which can be readily recycled. But first consumers must remove the spraytops, as they are made from different plastics and are not recyclable. Then consumers must find a way to pry off the brightly-colored, printed plastic wraps that packagers are increasingly wrapping around bottles to make the labeling more attractive.

> “Who does all that? Nobody,” said Sanborn.

I do! It's a little fiddly, but any sharp knife with a point you can slip under the label does a good enough job of slicing those off.

Good to know that helps, actually - I've often wondered whether I was wasting my time bothering with it.


I do too! Glad I'm not the only one. I also remove labels when possible and pull plastic tape off of corrugated cardboard boxes.

The one problem is with deposit beverage containers, plastic or glass, that have those plastic wrap labels. The proof of deposit is on the label, so you can't remove it or the recycler won't accept it. So now plastic is added into the glass recycling stream, or 2 different plastics are mixed in the plastic recycling stream.

I think packaging should be regulated. No mixed materials, printed not glued label, or only glue that can be removed. Plastic number stamped on every piece of plastic produced anywhere in the world. Mandate use of recyclable paperboard packaging instead of plastic wrap. No fake bio-degradable packaging. No embedded electronics or batteries.

Also education: everyone is responsible for their trash. Strip out the recyclables, keep them clean, minimize other trash. In the example of the singing birthday cards, it should be trivial to tear or cut out the electronics and put the paper card into the recycling.

If we had sensible regulations and responsible consumers, then with only a bit of effort, we could have valuable clean recycling streams and minimal landfill.


This post was your 22nd submission in the space of about an hour, in which time there were only 37 submissions from everyone else put together. One point in the new queue features six of your submissions in a consecutive row.

Per the Guidelines, https://news.ycombinator.com/newsguidelines.html:

Please don't submit so many links at once that the new page is dominated by your submissions.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: