Features in Development
and check
Use containerd for pulling and storing images
.
Or you can do add the following to Docker’s daemon.json
file:
{
"features": {
"containerd-snapshotter": true
}
}
This comes from a comment in a ticket for resuming downloads when they fail.
]]>Done
or some follow-up/waiting
area for future action. So I only see things I can act on now.
My list of things to action can get quite long, and when I’m processing
follow-up items, I would have a hard time dragging them to Done
because it
was too far away in the sidebar. So I wished I would make the Done
float
with me, so I could always have a quick way of pulling it there.
While looking at the custom styling in the Roam Book Club graph, I found
the #sticky
tag, which will make a block sticky over the children in the
block. So I took that CSS and modified it slightly to support making a
block float, so I could have it stay with me in the sidebar.
An example of how it looks in my sidebar before my new tags:
With the #sticky
tag from the Roam Book Club, I can make for example
Tasks
float when I’m scrolling inside the tasks. This can be super helpful
for keeping track of where you are (they use it for daily chat pages) but
not quite what I need:
Introducing #sticky-block
, which will make the block and all its children
float along at the top of the page, so I can always drag things there quickly:
/* To make blocks float, a constant in the sidebar */
.roam-block-container[data-page-links*="sticky-block"]
/* To make the a block float over its children.
So you see which block you're currently inside.
The weird \" is because it would match both sticky and stick-block and
double up the rendering.
*/
, .roam-block-container[data-page-links*="sticky\""] > .rm-block-main
{
position: sticky;
top: 0;
z-index: 11;
background: white; /* Might have to be adjusted for your theme */
padding-top: 4px;
padding-bottom: 2px;
margin-bottom: 10px;
box-shadow:
0 1px 1px rgba(0, 0, 0, 0.034),
0 1px 1px rgba(0, 0, 0, 0.048),
0 12.5px 10px rgba(0, 0, 0, 0.06),
0 12.3px 7.9px rgba(0, 0, 0, 0.072),
0 7.8px 10.4px rgba(0, 0, 0, 0.086),
0 5px 120px rgba(0, 0, 0, 0.12);
}
/* Hides the tag since it's not important in the output, and there is
special styling so it's clear that something extra is going on. */
span.rm-page-ref[data-tag="sticky-block"],
span.rm-page-ref[data-tag="sticky"] {
display: none;
}
Note: This CSS currently does not support having both #sticky-block
and
#sticky
for the same page, they will overlap each other, and the second
element will block the first. I don’t currently need this, so I haven’t spent
the time. :)
I just misplaced my Apple Watch in my apartment. Walking around looking for it, and getting frustrated, I was thinking, “There ought to be a way to make it make some sound, then I can play Marco Polo with the watch”. But my Google-fu failed me: no obvious way to “ping my watch”. There’s functionality for pinging the phone from the watch though.
But there’s a way to make some noise: testing out the alert volume in the companion app on the phone.
I’m running an open source project called gocd-cli which is, well, a command line interface for Go continuous delivery. The intention is to make it easier to handle common tasks around Go. But this post isn’t really about that.
This project is supposed to be as portable as I can make it, becuse the original need I felt for it was born on RHEL6. Which is blessed with Python 2.6 by default. And we should definitely be looking to the future, meaning supporting Python 3, and I luckily got a pull request for just that. Since I couldn’t find any free hosted Go around I went for the next best thing, Snap CI, which is also built by ThoughtWorks.
Easy to get going and works well, it’s not Go, but it’s definitely the easy starter drug for people that thinks Jenkins or Travis is good enough.
Snap supports all the versions of Python that I want by default, but they weren’t all being made available at the same time. Python 2.6 and 2.7 were always there, but only one version of Python 3 at a time.
Luckily logging in to the snap-shell I found that all Python versions were
available in /opt/local/python/<version>
.
A quick change to the Snap config, to add these to my $PATH
, and tox ran
through without any problems.
What you’ll need to add to your command box. Note it didn’t work for me when
I added it to the environment variable field, I’m guessing it’s because the $PATH
variable doesn’t get interpolated correctly.
export PATH="$PATH:/opt/local/python/3.3.5/bin:/opt/local/python/3.4.0/bin:/opt/local/python/3.5.0/bin"
And look, my tests are passing!
]]>Clearly the interpreter known what I want to achieve, and at the same time it’s programmed to give of an error message telling me I was doing it wrong. And for it to work I need to say, “pretty please”. What annoys me with this is just the simple fact that someone figured out people were having a problem with this, so they added in a message instead of just doing what is expected. You just don’t behave in that way in everyday life, you’d get slapped.
Time handling in Python is atrocious, do get it working halfway decently you need to install at least two external libraries. pytz and python-dateutil, and while I can understand why pytz might be a good candidate for being external (for allowing a higher pace of updates since timezone/DST changes happens every so often in different parts of the world).
Today I just wanted to do a diff between two dates and see the years between them, so I figured I would use timedelta since it sounds like something that should be part of that. Oh, really, it’s not? I can diff weeks but not months or years? So I ended up using dateutil’s relativedelta instead.
So far the worst way I’ve been bitten was with the built-in e-mail library, this ended up with me sending a copy of the e-mail addresses of 150 customers by mistake.
Output:
Because appending when doing an assignment is just what you’d expect. This from
the same people that needs to tell me I can’t type exit
but I need to type
exit()
.
Another thing I wanted to use was a windowing function when iterating over a list, instead of having it implemented in itertools the documentation for itertools explains how I can implement my own. Why!? If you’re taking the time to show of an implementation why should I have to copy that piece of code into my own codebase? What about The Zen of Python:
There should be one– and preferably only one –obvious way to do it.
I really like PEP8, I don’t agree with all parts of it but I can change. But I’m really looking forward to when the standard library finally is PEP8 compliant.
Which brings me to documentation. For the longest time I couldn’t understand why I had such problems understanding the Python documentation, whether it was the standard library or any third party library. When I was coding Ruby I never felt this stupid when reading documentation. (But I’ve been told I’m excused from feeling stupid when reading the SQLAlchemy documentation, apparently it’s not just me there.)
But I think I’ve figured it why I find the documentation so hard to understand now. When I’m reading documentation for Ruby I generally have the source code just one mouse click away. So when I wasn’t understanding what the documentation was saying I just flipped on the source code and I could figure it out.
With most Python libraries I’ve had to do something similar to this:
It’s a general “truth” that documentation in general sucks, so it’s just better read the source. But somewhere along the way I stopped doing that, probably around the same time I started using Rails and was amazed at how good the documentation was. And without thinking about it I was also already reading the source code, kind of, by having it readily available with the documentation.
My recommendation is for all of you out there using Sphinx for your documentation needs, please enable sphinx.ext.viewcode to output the source with your documentation.
The other thing I would like to say is the obvious thing, reading the source is great. I really started to enjoy using Django when I decided to just use the documentation to find whatever something was called and then use the source code to figure out how things work. Source code is almost like a painting, a line of code can say more than a thousand words. ;)
I’m not the first one to feel dismayed about Python, Zed Shaw has a great post called Curing Python’s Neglect that is well worth a read. (He mentions Lamson 0.9 in the post and that was released in 2009. As far as I can tell most of the things in his post is still a problem.)
As I understand a lot of making Python more streamlined is being put into Python 3, that just hasn’t been adopted by the majority of developers yet.
We Ruby people had the same thing with 1.9, and I noticed people really starting to switch about the same time as RVM started to be used. All of a sudden there was a really easy way to test things with any possible combination of Ruby you wanted.
All around I’m really enjoying working with Python, again (Python was the language I used to replace PHP/Perl way back when, then Python was replaced by Ruby). I used to really dislike having to import every single line of code I use, but since I’m a sucker for having things overly clear I’ve gotten round to it now. For some reason I never had an issue with the white spaces, I want the code I read to be consistent. And that’s one way of trying to ensure that.
Now that I’ve done the virtual variant of screaming out into the night I’ll go and try to be productive instead.
]]>The thing is though that we got two hosts running the exact same configuration, and we’d like to keep those hosts in sync. A quick search on Google gave me nothing for syncing varnish configuration over several hosts, or a farm as it were. So I took matters into my own hands and wrote varnishsync, a little bash script that uses rsync and ssh to sync the configuration folder and then to load and use the new configuration.
Please have a look at the Github project for the latest version and usage, and if you’ve any questions or suggestions drop a line here or on Github.
]]>This guide assumes you’re running Ubuntu or a Debian based system.
I’ve made a script that does all the steps below, feel free to use it!
The script: http://sanitarium.se/files/wikileaks-mirror.sh
Usage: wget http://sanitarium.se/files/wikileaks-mirror.sh && chmod +x wikileaks-mirror.sh && ./wikileaks-mirror.sh
#
is the prompt as root:
youruser$ sudo -s
Install apache if it’s not installed
#
apt-get install apache2
Add a wikileaks user, write down where the home folder is created.
#
adduser--
disabled-password wikileaks
#
su wikileaks
wikileaks$ mkdir ~/.ssh ~/www
wikileaks$ chmod 0700 ~/.ssh
wikileaks$ wget http://213.251.145.96/IMG/id_rsa.pub -O ~/.ssh/authorized_keys
wikileaks$ exit
Time to add the apache site for wikileaks
#
cd /etc/apache2/sites-available/
#
wget http://sanitarium.se/files/wikileaks
Open the file
wikileaks
with an editor and change the path to the wikileaks users home folder if it’s not/home/wikileaks
.
This file assumes you want to host wikileaks.org, if you want to host wikileaks.yourdomain.com you’ll need to setServerName
accordingly and if necessaryServerAlias
, ServerAlias is optional and you can remove that row if you don’t use it.
When that is done you just need to activate the site in apache:
#
a2ensite wikileaks
And reload apache so it knows that the new site has been added:
#
/etc/init.d/apache2 reload
The wikileaks
file downloaded from this server looks like this:
<VirtualHost *:80>
DocumentRoot /home/wikileaks/www
ServerName wikileaks.org
ServerAlias www.wikileaks.org
ErrorLog /dev/null
CustomLog /dev/null common
<Directory /home/wikileaks/www>
AllowOverride None
</Directory>
</VirtualHost>
Go to the form and fill it as the picture, set the IP-address of your server in the IP-field:
If you’re having any troubles don’t hesitate to ask in the comments!
]]>En kommentar i Rick Falkvinges inlägg Fullt krig om informationen så efterfrågades en snabbguide för att dra igång en Wikileaksspegling i ett vanligt Linuxssystem.
Jag utgår från Ubuntu eftersom det är vanligt och vad jag själv använder.
Uppdatering 2010-12-05: Jag har gjort ett script som utför alla stegen nedan, använd gärna det!
Filen: http://sanitarium.se/files/wikileaks-mirror.sh
Användning: wget http://sanitarium.se/files/wikileaks-mirror.sh && chmod +x
wikileaks-mirror.sh && ./wikileaks-mirror.sh
#
är prompten som root:
dinanvändare$ sudo -s
Installera apache om det inte är installerat
#
apt-get install apache2
Lägg till en användare för Wikileak och anteckna var wikileaks hemmap skapas!
#
adduser--
disabled-password wikileaks
#
su wikileaks
wikileaks$ mkdir ~/.ssh ~/www
wikileaks$ chmod 0700 ~/.ssh
wikileaks$ wget http://213.251.145.96/IMG/id_rsa.pub -O ~/.ssh/authorized_keys
wikileaks$ exit
Nu är det dags att lägga till siten för wikileaks
#
cd /etc/apache2/sites-available/
#
wget http://sanitarium.se/files/wikileaks
Öppna filen
wikileaks
med en editor och ändra sökvägen till användaren wikileaks hemmapp om det är något annat än/home/wikileaks
.
Den här filen förutsätter att du vill hosta wikileaks.org, om du vill hosta wikileaks.dindomän.se eller något sådant så får du ändra ServerName och eventuellt ServerAlias.
När det är klart är det bara att aktivera siten för apache:
#
a2ensite wikileaks
Och till sist ladda om apache så det är redo att ta emot information:
#
/etc/init.d/apache2 reload
Innehållet i filen wikileaks
som du tankar från den här servern är:
<VirtualHost *:80>
DocumentRoot /home/wikileaks/www
ServerName wikileaks.org
ServerAlias www.wikileaks.org
ErrorLog /dev/null
CustomLog /dev/null common
<Directory /home/wikileaks/www>
AllowOverride None
</Directory>
</VirtualHost>
Surfa in på formuläret och fyll i det enligt nedan, byt ut ip-adress mot IP:t för din server:
Om det är några oklarheter eller funderingar så fråga på i kommentarsfältet nedan så ska jag försöka hjälpa till att reda ut!
Uppdatering: Henrik Rouhivuori
upplyste om
att aptitude
inte finns i Ubuntu 10.10 så jag ändrade till apt-get
istället. Övertydligt att jag fortfarande hänger på 10.04. :)
Uppdatering 2: Henrik Holst berättade att du kan välja att inaktivera lösenordsinloggning när du skapar nya användare, så nu görs det istället för att rekommendera ett slumpmässigt långt lösenord!
Uppdatering 3:
David Vrensk
påminner om att sshd
är lite petig på att det bara är användaren som ska ha
rättigheter till .ssh
-mappen.
Uppdatering 4: Av bara farten så hade jag missat att lägga till att man
måste skapa mappen www
som wikileaks-filen pekar på, samt common
efter
loggraden. Tack till Gustav Wetter som
jobbet igenom hela guiden!
There are a lot of X resource configuration options that makes you think you can disable bold fonts, but alas, I’ve had no luck with any of them. But if you set the same font for both normal and bold fonts it’ll work! This little gem of knowledge I found as an off-hand remark on a configuration page by Emil Mikulic, thank you!
I like the normal fixed
font, I’ve tried many terminal fonts but I’ve always gotten back to it. So I simply tucked:
xterm*font: fixed
xterm*boldFont: fixed
Into my ~/.Xresources
and afterwards ran xrdb -load ~/.Xresources
and started up a new xterm loaded with awesomeness!
The before and after shot.
]]>