-
16 votes
-
Challenge: defuse this fork bomb
On lobste.rs I found link to an article from Vidar Holen, the author of shellcheck. He made a fork bomb that is really interesting. Here's the bomb: DO NOT RUN THIS. eval $(echo...
On lobste.rs I found link to an article from Vidar Holen, the author of shellcheck. He made a fork bomb that is really interesting. Here's the bomb:
DO NOT RUN THIS.
eval $(echo "I<RA('1E<W3t`rYWdl&r()(Y29j&r{,3Rl7Ig}&r{,T31wo});r`26<F]F;==" | uudecode)
This may look pretty obvious, but it's harder than you think. I fell for it. twice. Can you find out how this bomb works?
Warning: executing the bomb will slow down your computer and will force you to restart.
You can limit impact of the fork bomb by settingFUNCNEST
.export FUNCNEST=3
Have fun!
12 votes -
Next steps toward Go 2
6 votes -
Spatial: A language and compiler for application accelerators
4 votes -
Game Frameworks: What are people using for game jams nowadays?
Hi, I've been mulling ideas about a game for a while now, I'd like to hack out a prototype, and my default would be Love2D. (As an aside: one of the things I like about Love2D was that you could...
Hi,
I've been mulling ideas about a game for a while now, I'd like to hack out a prototype, and my default would be Love2D. (As an aside: one of the things I like about Love2D was that you could make a basic 'game' in a couple of LoC, and it was 'efficient enough' for what you got. Perhaps the only gripe I had with it was that it didn't output compiled binaries (I mean, you could make it do that, but it seemed like a hack). I think Polycode seemed to be a semi-serious contender, but last I checked (a year or two ago) it's pretty much as dead as a doornail. Some of the other alternatives I remember seeing (Godot? Unity?) felt too much like Blender.
So I've been wondering, it's been a while since I've been keeping tabs on the 'gamedev community', so I don't know if there have been any more recent development in that space.
So I guess my question is: What are people using for game jams nowadays? Preach to me (and everyone else) about your favorite framework and language :)
15 votes -
Genetic Algorithms
Introduction to Genetic Algorithms Genetic algorithms can be used to solve problems that are difficult, or impossible to solve with traditional algorithms. Much like neural networks, they provide...
Introduction to Genetic Algorithms
Genetic algorithms can be used to solve problems that are difficult, or impossible to solve with traditional algorithms. Much like neural networks, they provide good-enough solution in short amount of time, but rarely find the best one. While they're not as popular as neural networks nor as widely used, they still have their place, as we can use them to solve complicated problems very fast, without expensive training rigs and with no knowledge of math.
Genetic algorithms can be used for variety of tasks, for example for determining the best radio antenna shape, aerodynamic shapes of cars and planes, wind mill shapes, or various queing problems. We'll use it to print "Hello, World!".
How does it work?
Genetic algorithm works in three steps.
- Generate random solutions
- Test how good they are
- Pick the best ones, breed and mutate them, go to step 2
It works just like evolution in nature. First, we generate randomised solutions to our problem (in this case: random strings of letters).
Then, we test each solution and give it points, where better solutions gain more points. In our problem, we would give one point for each correct letter in the string.
Afterwards, we pick the best solutions and breed it together (just combine the strings). It's not bad idea to mutate (or randomize) the string a bit.
We collect the offsprings, and repeat the process until we find good enough solution.
Generate random solutions
First of all, we need to decide in which form we will encode our solutions. In this case, it will be simply string. If we wanted to build race cars, we would encode each solution (each car) as array of numbers, where first number would be size of the first wheel, the second number would be size of the second wheel, etc. If we wanted to build animals that try to find food, fight and survive, we would choose a decision tree (something like this).
So let's start and make few solutions, or entities. One hundred should be enough.
from random import randint goal = "Hello, World!" allowed_characters = list("qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM ,!") def get_random_entity(n, string_length): entities = [] for _ in range(0, n): entity = "" for _ in range(0, string_length): entity += allowed_characters[randint(0, len(allowed_characters)-1)] entities.append(entity) return entities print(get_random_entity(100, 13))
Test how good they are
This is called a "fitness function". Fitness function determines how good a solution is, be it a car (travel distance), animal (food gathered), or a string (number of correct letters).
The most simple function we can use right now will simply count correct letters. If we wanted, we could make something like Levenshtein distance instead.
def get_fitness(entity): points = 0 for i in range(0, len(entity)): if goal[i] == entity[i]: points += 1 return points
Crossover and mutation
Now it's time to select the best ones and throw away the less fortunate entities. Let's order entities by their fitness.
Crossover is a process, when we take two entities (strings) and breed them to create new one. For example, we could just give the offspring one part from one parent and another part from second parent.
There are many ways how to do this, and I encourage you to try multiple approaches when you will be doing something like this.
P: AAAABBB|BCCCC P: DDDDEEE|FGGGG F1: AAAABBB|FGGGG
Or we can just choose at random which letter will go from which parent, which works the best here. After we have the offsprint (
F1
), we should mutate it. What if we were unfortunate, andH
(which we need for ourHello, World!
) was not in any of the 100 entities? So we take the string and for each character of the string, there is a small chance to mutate it - change it at random.F1: ADDDEBEFGCGG F1`: ADHDEBEFGCGG
And it's done. Now kill certain part of old population. I don't know which percentage is best, but I usually kill about 90% of old population. The 90% that we killed will be replaced by new offsprings.
There is just one more thing: which entities do we select for crossover? It isn't bad idea - and it generally works just fine - to just give better entities higher chance to breed.
def get_offspring(first_parent, second_parent, mutation_chance): new_entity = "" for i in range(0, len(first_parent)): if randint(0, 100) < mutation_chance: new_entity += allowed_characters[randint(0, len(allowed_characters)-1)] else: if randint(0, 1) == 0: new_entity += first_parent[i] else: new_entity += second_parent[i] return new_entity
When we add everything together, we get this output:
Generation 1, best score: 2 ::: QxZPjoptHfNgX Generation 2, best score: 3 ::: XeNlTOQuAZjuZ Generation 3, best score: 4 ::: weolTSQuoZjuK Generation 4, best score: 5 ::: weTgnC uobNdJ Generation 5, best score: 6 ::: weTvny uobldb Generation 6, best score: 6 ::: HellSy mYbZdC Generation 7, best score: 7 ::: selOoXBWoAKn! Generation 8, best score: 8 ::: HeTloSoWYZlh! Generation 9, best score: 8 ::: sellpX WobKd! Generation 10, best score: 9 ::: welloq WobSdb Generation 11, best score: 9 ::: selloc WoZjd! Generation 12, best score: 10 ::: wellxX WoVld! Generation 13, best score: 10 ::: welltX World! Generation 14, best score: 10 ::: welltX World! Generation 15, best score: 10 ::: welltX World! Generation 16, best score: 11 ::: zellov Wobld! Generation 17, best score: 11 ::: Hellty World! Generation 18, best score: 11 ::: welloX World! Generation 19, best score: 11 ::: welloX World! Generation 20, best score: 11 ::: welloX World! Generation 21, best score: 12 ::: welloX World! Generation 22, best score: 12 ::: Helloy World! Generation 23, best score: 12 ::: Helloy World! Generation 24, best score: 12 ::: Helloy World! Generation 25, best score: 12 ::: Helloy World! Generation 26, best score: 12 ::: Helloy World! Generation 27, best score: 12 ::: Helloy World! Generation 28, best score: 12 ::: Helloy World! Generation 29, best score: 12 ::: Helloy World! Generation 30, best score: 12 ::: Helloy World! Generation 31, best score: 12 ::: Helloy World! Generation 32, best score: 12 ::: Helloy World! Generation 33, best score: 12 ::: Helloy World! Generation 34, best score: 13 ::: Helloy World! Generation 35, best score: 13 ::: Hello, World!
As we can see, we find pretty good solution very fast, but it takes very long to find perfect solution. The complete code is here.
Maintaining diversity
When we solve difficult problems, it starts to be increasingly important to maintain diversity. When all your entities are basically the same (which happened in this example), it's difficult to find other solutions than those that are almost the same as the currently best one. There might be a much better solution, but we didn't find it, because all solutions that are different to currently best one are discarded. Solving this is the real challenge of genetic algorithms. One of the ideas is to boost diverse solutions in fitness function. So for every solution, we compute distance to the current best solutions and add bonus points for distance from it.
20 votes -
Generative Adversarial Networks - The story so far
6 votes -
How Verizon and a BGP optimizer knocked large parts of the internet offline today
14 votes -
Monsters in the Middleboxes: Introducing Two New Tools for Detecting HTTPS Interception
9 votes -
Need a simple way to password protect a webpage
Hey Tildes! I've got a static, basic website, HTML and CSS. It's one page only. But I'd like to create a second page with some more private content that is password protected. I know that I can...
Hey Tildes!
I've got a static, basic website, HTML and CSS. It's one page only. But I'd like to create a second page with some more private content that is password protected.
I know that I can accomplish this via .htaccess but what I don't like about this method is that when the user navigates to the page, they get a pop up asking for a username and password. What I would like is having the user navigate to the page, and then they are met with a simple form asking for just a password (no username). After they enter the password, the "veil" lifts or the page forwards and they get the private content.
Here's the thing... the content really only needs to seem private. It's not super secret, personal information. I don't want it indexed by search engines (nofollow), and I want it basically hidden, but the password is only there to make the user feel exclusive. If some tech-minded person encountered this page and jumped through a bunch of hoops to get in without the password, it's not a big deal to me. In reality, 99.9% of people accessing this page will not be able to bypass the password.
I'm guessing this can be accomplished easily in Javascript, but I don't really know much Javascript apart from finding code snippets and plunking them in. I also want to be able to fully design the password entry page so that it looks branded, so a code snippet plunked down into my HTML doc would be great for this.
If there is an easy way to actually protect the content behind the password, that would be excellent. In this case, I imagine it would be much like a news site with an ad-blocker-blocker. Just some kind of pop-up that blocks all the content. Enter the password, and you're in.
Anyhow, I hope I've described what I'm looking for accurately enough. Anybody have any easy and quick ways to accomplish this?
14 votes -
What are the minimal features every good blog should have?
I've been learning Laravel, and familiarizing myself with the framework by coding up a blogging website. Right now, it's minimally functional, and I'd like to add some more features to it. Since...
I've been learning Laravel, and familiarizing myself with the framework by coding up a blogging website. Right now, it's minimally functional, and I'd like to add some more features to it. Since this is my first project with Laravel the code is a mess, and it's just about time for me to rewrite the whole thing. Before starting that, I'd like to have a better idea of what my final product should be. I don't want to recreate WordPress in Laravel, but I do want to have something I wouldn't spit at. Basically a project that would be good as a resume builder if I ever needed one.
So far, my website allows users to...
- register for an account, log in/out, update their email address and display name
- create posts with a WISIWYG editor
- upload files
- create profiles
- and manipulate everything through CRUD.
What do you think the minimal features a blogging platform needs to have to be "complete" and usable as a stand-alone system?
13 votes -
Introducing time.cloudflare.com, a free time service that supports both NTP and the emerging Network Time Security (NTS) protocol for securing NTP
13 votes -
Towards Post-Quantum Cryptography in TLS
8 votes -
Software Architect as a Developer Pension Plan
11 votes -
Mercury: a speculative reimagining of the operating system
8 votes -
Hacking thousands of websites via third-party JavaScript libraries
5 votes -
What happens behind the scenes when we type www.google.com in a browser? (2015)
8 votes -
MacOS Folks -- chunkwm is dead, yabai is the future (same dev, too!)
tldr; chunkwm has been completely rewritten and is now yabai From the chunkwm site: chunkwm is no longer in development because of a C99 re-write, yabai. yabai was originally supposed to be the...
tldr; chunkwm has been completely rewritten and is now yabai
From the chunkwm site:
chunkwm is no longer in development because of a C99 re-write, yabai.
yabai was originally supposed to be the first RC version of chunkwm. However due to major architectural changes, supported systems, and changes to functionality, it is being released separately. There are multiple reasons behind these changes, based on the experience I've gained through experimenting with, designing, and using both kwm and chunkwm. Some of these changes are performance related while other changes have been made to keep the user experience simple and more complete, attempts to achieve a seamless integration with the operating system (when possible), proper error reporting, and yet still keep the property of being customizable.
For those who don't know, chunkwm was / is a tiling windows manager that is sort of like bspwm / i3 etc. I've been using chunkwm for a few months now and love it. If you're also an i3 user, the lack of a proper super key does make your key combos different, but overall its an excellent window manager. Both chunkwm and yabai use koekeishiya's Simple Hotkey Daemon (skhd).
Anyway, I gave the new version the day and its pretty good, but still has some quirks. It seems like development is moving along quickly, so keep an eye on it.
8 votes -
Things I Learnt The Hard Way (in 30 Years of Software Development)
5 votes -
Source Code for Libra: Facebook's Cryptocurrency
8 votes -
Mezzano - An operating system written in Common Lisp
11 votes -
Linux and FreeBSD Kernel: Multiple TCP-based remote denial of service vulnerabilities
7 votes -
SerenityOS - A Custom New Unix-like OS
13 votes -
The Ballad of AM4: How AMD Stretched a CPU Socket from 28nm to 7nm
9 votes -
Do generic CLI to GUI wrappers exist?
So I've been messing around with the webp encoder cli tool and I really wish I could quickly achieve a workflow more similar to photoshop's previews. Is there a GUI tool out there where I can...
So I've been messing around with the webp encoder cli tool and I really wish I could quickly achieve a workflow more similar to photoshop's previews. Is there a GUI tool out there where I can specify the arguments for an CLI executable then it lets me adjust the values and run the command. Ideally it would automatically let me view the output file, and define presets would be great.
10 votes -
The world in which IPv6 was a good design
9 votes -
What is your favourite programming language?
What is the programming language you enjoy the most, or otherwise define as your favourite? Why is that particular language your favourite? Bonus: add just a little bit of code in it that you...
What is the programming language you enjoy the most, or otherwise define as your favourite? Why is that particular language your favourite?
Bonus: add just a little bit of code in it that you think exposes its beauty.
37 votes -
Google Project Zero researcher releases denial-of-service vulnerability in Windows SymCrypt library
9 votes -
Notes and conclusions from trying to host a static blog on IPFS
11 votes -
Project Svalbard: The Future of Have I Been Pwned
25 votes -
Introducing Matrix 1.0 and the Matrix.org Foundation
7 votes -
Atom 1.38 Release and Atom 1.39 Beta
7 votes -
Richard Hipp - Git: Just Say No
7 votes -
From design patterns to Category theory
8 votes -
Emacs merges HarfBuzz support to master branch
10 votes -
Music on the Altair 8800
4 votes -
What is your personal preference and why: vim or emacs?
This is of course the age old debate, which on other sites has been known to quickly devolve (one of the Internet ‘holy wars’ of yore). Nonetheless, I am curious. I personally use vim. Part of the...
This is of course the age old debate, which on other sites has been known to quickly devolve (one of the Internet ‘holy wars’ of yore). Nonetheless, I am curious.
I personally use vim. Part of the reason is surely that it is just the first one of the two that I happened to use, and thus by the time I tried emacs I was used to vim. But more broadly, I enjoy using vim because once you get over the hump of ‘weird’ commands and modes, I feel that vim most closely emulates the feelings and thought process that you have when building something with your hands. You can pick up different tools, yank pieces out and rearrange them, turn the object around in your hands to see different parts, etc etc. Once you internalize the movement and editing you really start flying around. At that point the interface seems less like a barrier between you and the text and more like a way to ‘hold’ it.
Of course, people have different preferences.
15 votes -
7 absolute truths I unlearned as junior developer
25 votes -
Boundaries: A talk by Gary Bernhardt from SCNA 2012
3 votes -
Blender is Free Software
16 votes -
Web Design Work
Hi everyone! Per admin recommendation I'm posting this in comp. I would like to switch Staining The Timbre from a blogspot domain to its own. I can handle the paperwork and whatnot associated with...
Hi everyone! Per admin recommendation I'm posting this in comp.
I would like to switch Staining The Timbre from a blogspot domain to its own. I can handle the paperwork and whatnot associated with the url change, but I would like to hire a web designer to spruce up the joint a bit. Right now I'm using a default theme provided by Blogspot and, while it serves its purpose, it makes the page look like it's run by a high schooler.
It should be a relatively basic project. I don't need anything for commerce set up, or anything I think of as "crazy". Just a very basic blog layout that looks professional on both desktop and mobile (the latter is a little lacking in particular right now). Archive links, Tags, ability to comment on posts, Contact Info, and one that preferably preserves the large-picture format the site currently has; that's about it, aside from being able to create the posts themselves.
If anyone is interested please send me a private message. This is very much still in the quoting phase, but I appreciate any assistance you all can provide me in getting an idea on cost.
Thanks in advance!
8 votes -
Mesa 19.2's Virgl Sees Huge Performance Win Around Buffer Copy Transfers
6 votes -
What do you Tildians think of Atom?
I was looking for an open source editor and I found Atom. It looks pretty cool. What do the experienced programmers, etc. think about it?
29 votes -
How does Apple (privately) find your offline devices?
13 votes -
The Expression Problem and its solutions
4 votes -
Reddit Terminal Viewer development is shutting down, owner citing burnout and disillusionment with Reddit as a platform
56 votes -
aerc: Email Client for the Terminal
17 votes -
Salsify: Better real-time video
7 votes -
The problem with SSH agent forwarding
4 votes -
CSS Grid Level 2 – subgrid is coming to Firefox
8 votes