Hello, World!Using ld this can be read in as a plain binary blob, and then written as a standard relocatable ELF object.
ld -r -b binary -o foo.o foo.txtNow we have a standard ELF object with the data and some useful symbols defined. objdump will show you the contents.
$ objdump -x foo.o
foo.o: file format elf32-i386
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 0000000d 00000000 00000000 00000034 2**0
CONTENTS, ALLOC, LOAD, DATA
SYMBOL TABLE:
00000000 l d .data 00000000 .data
0000000d g .data 00000000 _binary_foo_txt_end
0000000d g *ABS* 00000000 _binary_foo_txt_size
00000000 g .data 00000000 _binary_foo_txt_start
Here we see 13 bytes of data, and a symbol which contains the address of
the data. This is all we need to access it from a C program.
#include <stdio.h> extern char _binary_foo_txt_start[]; int main (void) puts (_binary_foo_txt_start); return 0;Now if we compile this and link it against the generated object, we'll have a binary.
$ gcc -o test test.c foo.o $ ./test Hello, World!Hooray! One small problem which alert people should have noticed: the string itself is in the .data section, which is read/write. For my use, I want it to be read-only data in the .rodata section so that it isn't copied for every instance of the application. As far as I know, this isn't possible with ld but objcopy will let us rename sections on the fly.
$ objcopy --rename-section .data=.rodata,alloc,load,readonly,data,contents foo.o foo.o $ objdump -h foo.o ... 0 .rodata 0000000d 00000000 00000000 00000034 2**0Excellent, problem solved. If you want to download this sample, I have a tarball. Many thanks to Daniel Jacobowitz for pointing out how to achieve this. Update: note that any data embedded in the binary like this won't be terminated with a NULL. This is obvious in hindsight, but due to luck my example still worked. There might be a way of asking objcopy to append a 0 to the end of the data, but if not always remember to use the start and end pointers or size instead of just the start, or append a NULL yourself before converting to an ELF. NP: (), Sigur Rós
IFACE=wifi0 # setup ingress filtering /sbin/tc qdisc add dev $IFACE handle ffff: ingress # local network is unrestricted /sbin/tc filter add dev $IFACE parent ffff: protocol ip \ prio 10 u32 match ip src 192.168.2.0/24 \ police conform-exceed ok/ok flowid :1 # incoming internet traffic is limited. /sbin/tc filter add dev $IFACE parent ffff: protocol ip \ prio 50 u32 match ip src 0.0.0.0/0 police \ rate 1500kbit burst 10k drop flowid :2 # outgoing traffic /sbin/tc qdisc add dev $IFACE root handle 1: htb default 30 # local network is unrestricted /sbin/tc class add dev $IFACE parent 1: classid 1:10 htb \ rate 54mbit burst 15k /sbin/tc qdisc add dev $IFACE parent 1:10 handle 10: sfq perturb 10 /sbin/tc filter add dev $IFACE parent 1:0 protocol ip \ prio 10 u32 match ip dst 192.168.2.0/24 flowid 1:10 # internet traffic is limited. /sbin/tc class add dev $IFACE parent 1: classid 1:20 htb \ rate 160kbit ceil 196kbit burst 15k /sbin/tc qdisc add dev $IFACE parent 1:20 handle 20: sfq perturb 10 /sbin/tc filter add dev $IFACE parent 1:0 protocol ip \ prio 50 u32 match ip src 0.0.0.0/0 flowid 1:20Long example, I know. The main reason is that I'm not limiting traffic to local computers. Furthermore, I'm also limiting my incoming traffic to use up at most 1.5 mbit of the 2 mbit connection, so my housemates will be able to use the internet as well (Debian mirrors send data fast - fast enough to kick them out of any online game they might be playing...).There is one important detail hidden in there: sfq. This stands for "stochastic fair queueing". It tells the network stack to basically send "one packet for each connection in turn". This way, the small packets needed for download or interactive SSH sessions will get out quickly even when doing a larger upload.It works great for me - I'm having a good download rate, using the 160 kBit upload limit completely (I don't want to completely fill up the 192k upload link either) and I'm actually writing this blog entry remotely via SSH. The lag when writing is okay, probably around 300ms. Without shaping, this wouldn't work this well.(And no: just using 'sfq' for your outgoing traffic is not enough, since the key scheduling is happening at the weakest link. So you have to limit your traffic shaping setup to be just below the actual weakest link.)
The phrase "rebel with rather too many causes" was a phrase originally directed at protest.net -- a event calendaring system for activists that I was briefly involved in over a summer during college. I like the phrase and use it frequently but I didn't want to take credit for it. Google indicates that it originates in NTK #53 I'm not at all surprised.
My parents worked as doctors in Kenya, Papa New Guinea, and elsewhere before they had children. This probably doesn't matter to anyone else but they worked with an organization that was like MSF in that it was a humanitarian organization that sent physicians around the world but it was not actually MSF as the article states. I don't think MSF had grown beyond French doctors when my parents were practicing overseas.
When LWN pointed to the article, and in the original was well, there a focus on some comments I make about non-profit organizations. Since in a context of talk about my political work I just want to clarify my comments in a little more depth here. I think that one problem that has stemmed form Open Source's emphasis on businesses and efficiency is that free/open source software people end up making arguments in business terms: you should use application X because it is more efficient and faster. For many of the folks who have built this whole movement though, and for most in the free software camp, it's about freedom, not efficiency. By targeting businesses, we encounter a skeptical audience. More importantly though, we end up making arguments that, while true, are not the ones that motivate us. I think that low-hanging fruit for free software activists might include groups that already support free software ideas of sharing and user empowerment and that are looking for ways to use free software already. Groups we don't need to be afraid about saying "freedom" around. Not so coincidentally, these are sometimes organizations that I have a lot in common with politically. But that's far from always the case. There's a big group of philosophically aligned organizations in the NGO/non-profit community and the problems keeping them away are often technical. This is good news, of course, since solving technical problems is the free software movement's core competency. This is something I've been thinking about for a long time: Debian-NP was one project I helped start that tried to address this issue. Now, many people involved in the FSF, including myself, have political convictions that go beyond software. I do not want these convictions, and my statements about philosophically aligned organization, to be interpreted as call for a political shift in the organization in mainstream political terms. I deeply respect the way that RMS has kept his political opinions separate from the Foundation's. Biella and I have ever written about the importance of this political demarcation to free software's success. It's certainly not something I would want to change.
[remote "origin"] url = ssh://server/path/to/repo.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/masterThe "remote" stanza defines a remote repository with the nickname "origin". If the user calls git fetch without arguments, it will download all remote branches (refs/heads/*) and store those as remote branches with the origin/ prefix. Thus, the branch "big-fat-feature" in refs/heads/big-fat-feature on the other side becomes the remote branch "origin/big-fat-feature" (refs/remotes/origin/big-fat-feature). The "branch" stanza informs git about the default source for merges when the "master" branch is current. If the local "master" branch is checked out and the user calls git pull without arguments, it instructs git to fetch all branches (see above), then merge the remote "master" branch (refs/heads/master) into the current branch. I started a new project in git today and decided to go public after I had already made a few commits and created a number of branches. So I set out to learn a bit more about git internals and came up with two ways to publish the repository such that my local repository would also know about the remote side as if it had been cloned from the start. The documentation didn't leave me satisfied, so I had to try it all out. Being new to git, my first thought was to push/publish my repository to a public location, and so I did:
### assuming ssh://server/remote.git resolves to an empty, bare git repo ### and that we are chdir()'d to the local repository: $ git push --all ssh://server/remote.git $ git remote add origin ssh://server/remote.git $ git config branch.master.remote origin $ git config branch.master.merge refs/heads/master $ git fetch $ git merge master $ git branch big-fat-feature * master ponies $ git branch -r origin/big-fat-feature origin/master origin/poniesAnother method then dawned on me, but it's not necessarily better. Instead of pushing, let's copy a clone over and then clone that once more:
$ git config core.bare true $ scp -r .git server:/remote.git $ mv pwd pwd /../OLD $ cd .. $ git clone ssh://server/remote.git $ cd remote $ git branch big-fat-feature * master ponies $ git branch -r origin/HEAD origin/big-fat-feature origin/master origin/poniesThis does almost the same, except for that origin/HEAD branch, but that's just a local symbolic ref (a "symlink") and can just be removed, really:
$ rm .git/refs/remotes/origin/HEAD $ git branch -r origin/big-fat-feature origin/master origin/poniesNow the only thing left is setting core.sharedRepository on the remote side to let git know how to handle the Unix permissions. And that's it. NP: Antimatter: Lights Out
"If Veolia does not have enough manpower it will send out a green waste lorry, or a domestic refuse lorry which usually picks up black bag rubbish, to pick up both at the same time. [...] The staff will just take it for granted that green waste is in the green lorries and domestic waste is in the blue lorries."This is bad on many levels, even worse than my old example where recycling-ready waste was knowingly tipped into landfill. There's green waste contamination and false collection statistics, for starters. The article continues to report that Cllr Carl Francis-Pester, North Somerset Council's executive member for environment, said:
"We are carrying out an immediate investigation into these allegations which we take very seriously indeed. This investigation will include urgent discussions with the contractor to ensure they are fulfilling the contract we have with them in the correct manner."There doesn't seem to be any information about this investigation on North Somerset Council's web site. And if Veolia have spotted a loop-hole in the contract, then what? Even if they haven't, the council has to watch solely-profit-led contractors like hawks because if you give them a chance to cut costs (and therefore increase profits), they will try it. That is the hidden cost of outsourcing, not covered by the Best Value Indicators and other privatised council jargon. Incredibly, the councillor continues with:
"Thanks to the residents of North Somerset we have increased our recycling rate from 20.5 per cent to 30.8 per cent in the last 12 months."If the allegations are true, then no, we haven't, because the statistics would be as full of toxic rubbish as the green waste lorries. Have private rubbish collectors been doing this elsewhere?
Next.