Archives 2005 - 2019

Papa November: Kalla krigets nummerstationers bisarra värld

published Jun 06, 2010 07:54   by admin ( last modified Jun 06, 2010 07:54 )

Det finns en hel värld av kortvågsstationer som sänder vad som verkar vara meningslös och repetitiv information, men som ibland är kodade meddelanden till hemliga agenter. Dessa stationer skickar ut något som skulle kunna beskrivas som antitetesen till spam: Vad gäller spampost så är det utformat för att verka intressant och viktigt, men innehåller egentligen banal och ointressant information. Syftet är att nå så många som möjligt med denna skräp-information.

Nummerstationerna sänder istället ut något som verkar banalt och ointressant, men som innehåller viktig information. Syftet är att nå några få agenter med vanliga kortvågsradioapparater.

Aktiviteten har sjunkit sena kalla krigets slut, men det finns tydligen många igång fortfarande.

Efter en snabb titt på sajten Number Stations så kan man hitta sådana här guldkorn, som Papa November:

I remember tuning into a station in 1971 and being almost hypnotised by the strange interval signal (it is a different one now). It consisted of a female voice repeating "Papa November" over and over continuously with a sort of snake charmer's flute playing in the background. This went on for five minutes, after which a woman would start sending messages in five figure groups.
Läs mer: G15 Papa November

Eller den franska tyrolerstationen:

Here is the full Tyrolean Music station transmission starting with a music box rendition of the "Internationale", followed by several yodelling songs with the message for Helmut, Kruse and Frank buried in there somewher

Hittade alltihopa via en Slashdotdiskussion:

Läs mer: G1 Tyrol

You never know, the Russian Woodpecker [wikipedia.org] signal turned out to be a nuclear launch detection radar in Chernobyl.



Läs mer: Slashdot Technology Story | Mysterious Radio Station UVB-76 Goes Offline


Link - Regular expression http purging with varnish

published May 29, 2010 05:11   by admin ( last modified May 29, 2010 05:11 )

Just a quick note to self about some documentation on how to purge the Varnish cache with regular expressions in the purge urls, untested by me at this point in time.

. However, this way of implementing purge does not support wildcard purge. If you want to do that, use something like: acl purge { "localhost"; "192.0.2.14"; } sub vcl_recv { if (req.request == "PURGE") { if (!client.ip ~ purge) { error 405 "Not allowed."; } purge("req.url ~ " req.url); } where the URL is then a regular expression to purge.



Läs mer: VCLExamplePurging – Varnish


Pypi eggs notebook

published May 21, 2010 12:41   by admin ( last modified May 21, 2010 12:41 )

This is just a post for me to keep jotting down info on eggs on pypi that for some reason or other seem to be of interest.

 

Pillow is a "friendly" PIL fork. PIL is the Python Imaging Library



Python Package Index : Pillow 1.6


I wonder if ths one could be useful for tracking down hard to find errors:

 

This package allows to browse zope.annotation based items. Package provides "ann_view" browser view which lists all available (and allowed) annotation keys and their values.



Python Package Index : collective.annotationbrowser 0.2


 


This one for storing data in Plone without having to do it in a fully fledge content type on the one hand or in a dictionary on the other hand:

Its addressed to developers needing to solve the problem of storing tiny entities of mass-data, where heavy weight archetypes or dexterity are too much effort and are to slow. I.e if you need a container for non-CMSish content, like votes, data from a poll, orders in a webshop, measuring data, or alike.



Läs mer: Python Package Index : cornerstone.soup 2.1

 

 


Thus, if you have a subtractive workflow as the second workflow in a two-workflow chain, and you invoke a transition from either the first or the second workflow, the permissions from both will apply, with the subtractive workflow allowed to override the normal workflow.



Python Package Index : collective.subtractiveworkflow 2.0b1


Not an egg but a way to store references on the object instead of in a catalog:

(untested by me)

SimpleReferenceField


Best way to set up a mirror?

 

 

 

This article describes how to set up an own mirror of the Python Package index (aka Cheese-Shop)



Läs mer: Setting up a PyPI mirror (with z3c.pypimirror) — BlueDynamics Alliance


 

 
Making sharing roles in plone via xml:

 

Specifically, it provides a GenericSetup handler to export/import the available roles. The file should be called sharing.xml, and have the following format:



Python Package Index : collective.sharingroles 1.0b4


 

Take a look at how the authentication is done:

 

The http proxy server will authenicate user credentials based on backend Plone user sources and provide a extra session on top of Plone's session (cookie).

Läs mer: Python Package Index : leocornus.django.ploneproxy 0.1dev-r420

 

 


An alternative to Getpaid? Should install this and take a look.

 

PCommerce (Plone commerce) provides a simple shop system which supports

Python Package Index : pcommerce.core 0.4


 

drainers is an abstraction around subprocess.Popen to read and control process output event-wise. It also allows you to abort running processes either gracefully or forcefully without having to directly interact with the processes or threads themself.



Python Package Index : drainers 0.0.3

 

 

 


 

This is practical for caching purposes: it is the ideal place to determine and insert caching headers into the response.



Python Package Index : plone.postpublicationhook 1.1

 


"parses an HTML file for external resources (JavaScript, CSS and image files) and assembles them into a stand-alone document"

Python Package Index : spackager 0.5.0

 

 


This can speed up repetitive web entry tasks, such as testing a web function through the browser over and over again:

 

Web testing framework intended for complete automation of user interface testing, with strong test debugging and recording capabilities.



Python Package Index : windmill 1.3

 


Update ZODB class references for moved or renamed classes



Python Package Index : zodbupdate 0.4

 


 

uwosh.timeslot offers a simple way to allow users of a Plone site to register for events (for example: training sessions).



Python Package Index : uwosh.timeslot 1.4.7

 


Länk - The Economist on DNA synthesizing

published May 21, 2010 02:10   by admin ( last modified May 21, 2010 02:10 )

 

No one now knows how easy it would be to turbo-charge an existing human pathogen, or take one that infects another type of animal and assist its passage over the species barrier. We will soon find out, though.



Läs mer: Synthetic biology: And man made life | The Economist


An explanation for the down-to-cents dip on the US stock markets?

published May 20, 2010 12:15   by admin ( last modified May 20, 2010 12:15 )

The strange dip down to cents of some shares on the US stock markets could have a simple explanation. There might have been automated systems that had been programmed to sell some shares if they went below a certain market price. If these systems have many shares, they may sell a lof of them at the same time.

Now if the buying if these shares is also automated, there may have been an area of prices that the automated selling and buying systems weren't configured for. For example, say share X is normally priced at $100. For some reason it is pushed to $80. A this point one system with a heck of a lot of shares sell, or several systems that all have roughly the same sell point, sell.

Now other automated systems snap up these cheap shares, but there are not enough of them so the price goes down a bit further, to say $75. At this price point the systems that just bought the shares sell again. Now there should be systems picking up at that price, but let's say that those (bottom feeding) systems may have been configured to trade not in one share but in a low market in general, preferring to snap up a combination of shares. So they do not buy one low share.

So basically the shares that were sold a pennies, were sold at pennies because they were deemed stable. Noone could imagine prices going so low for them, without a general market crash.

If this explanation or one similar is correct , we have encountered something counter intuitive:

That the shares went down to pennies because the companies are solid as rock.

A stop order triggers when a price goes under a specific price, and sells as a market order: It takes the best offer available at the time.



Läs mer: Slashdot Comments | New "Circuit Breaker" Imposed To Stop Market Crash


Analys: Sverige och Singapore bland de få länder som kan klara skuldkrisen

published May 16, 2010 02:01   by admin ( last modified May 16, 2010 02:01 )

...problemet är att det inte är så bra att vara ett litet land när de stora ekonomierna  (USA, Euroland, förmodligen även Kina) går i väggen.

"Den som är satt i skuld är icke fri" hette Göran Perssons självbiografi. Nu visar det sig att de flesta länder i väst har skuldsatt sig så till den milda grad att det kommer att bli mycket svårt för dem att bli skuldfria: De besparingar som faktiskt krävs framför kan vara omöjliga att genomföra.

Johan Norberg skriver om skuldsättningen i Svenskan:

När bolag är bankrutta kan de räddas av staterna. När det gör staterna konkursfärdiga kan de räddas av EU. Men vem kan rädda EU?

En bro som slutar över avgrunden | Ledarsidan | SvD

 

Bank for International Settlement har gjort ett working paper och Bloggen Hotel Ivory har gjort en analys och visar ett diagram ur rapporten, på hur det går för olika länder med:

  • Inga åtstramningar
  • Åtstramningar
  • Mycket kraftiga åtstramningar (blå streckad linje)

Observera att många länder inte kommer igenom skuldkrisen ens med de kraftigaste åtstramningarna (blå streckad linje).

Kanske bör dessa länder ställa in betalningarna? Ryssland gjorde det, likaså Mexiko för inte så länge sedan.

 

The only developed countries I see, that have pretty good fiscal discipline and will only be affected indirectly by the problems of the other countries are:
* Norway (thanks to the North Sea oil and gas, Norway’s balance sheet is rock solid – don’t think they have any net debt)
* Sweden
* Denmark (The currency is pegged to the euro though)
* Switzerland
* Singapore
* Canada
* Australia
* New Zealand
* and maybe South Korea , Taiwan and Chile



Läs mer: Well, Western World, that was a nice 500 year streak « Hotel Ivory


Euromedlemsskap och statsskuld verkar korrelerat en del

published May 09, 2010 01:18   by admin ( last modified May 09, 2010 01:18 )

Holländska sajten nrc.nl visar en flash där man kan se följande stapediagram. Ljusare stapel är utanför euroland:

 

Det verkar som att de mörkare staplarna samlats i den övre delen av diagrammet.

Print this article


Läs mer: nrc.nl - International - Economic crisis in European Union


Extract (cut) a clip with mencoder and ffmpeg

published May 06, 2010 11:40   by admin ( last modified May 06, 2010 11:40 )

ffmpeg -sameq -ss 00:02:00 -t 8 -i long.mov short.mov

ffmpeg -y -i input.avi -ss 30 -t 10 -vcodec copy -acodec copy output.avi

mencoder -ss 1284 -endpos 102 movie.avi -oac copy -ovc copy -o movie-clip.av

 

mencoder also accepts hh:mm:ss format

mencoder -ss 1284 -endpos 102 movie.avi -oac copy -ovc copy -o movie-clip.avi



Läs mer: handy mencoder/ffmpeg commands


Länk - Bayesiska nät - en introduktion

published May 05, 2010 12:38   by admin ( last modified May 05, 2010 12:38 )

Här en dansk text som visar ett väldigt enkelt Bayesiskt nät (Bayesian net). Bayesiska nät är en form av AI (Artificiell Intelligens) som hjälper en att få fram sannolikheter givet en modell där ett antal noder och kopplingar används för att visa antaganden, observationer och beroenden.

En landmand med husdyrhold skal så hurtigt som muligt konstatere, om et dyr, som er blevet parret (løbet) nu også er blevet drægtigt.

Läs mer: Bedre Beslutninger med Bayesianske Netværk

 

Mer om bayesiska nät i agrikultur (på engelska):

Simple examples of Bayesian Networks and Markov Processes with applications within Agriculture.

Läs mer: Bayesian Networks and Markov Processes


How to get the total size of a directory in Linux

published May 05, 2010 05:05   by admin ( last modified May 05, 2010 05:05 )

du -sh

-h means print it human readable (with MB, kB)

-s mean summarize, i.e. don't print the size of sub directories


Recension: Dokumentären Överdos, om nästa finanskris

published May 04, 2010 05:29   by admin ( last modified May 04, 2010 05:29 )

Sammanfattning: En mycket viktig film, och tillräckligt bra gjord, men når i form och disposition inte upp till bästa BBC/Channel Four-klass.

En del, däribland jag, tror att en värre ekonomisk kris lurar runt hörnet. Många verkar tro att ett liberalt frihandelssystem med kapital och marknader är ett system bland andra, ett val man fritt kan göra bland andra system. Så är inte riktigt fallet. Istället är systemet en kodifiering av hur saker och till verkligen går till: Marknader finns alltid, och människor kommer att använda sin frihet att inrätta saker på bästa sätt. En liberal ekonomi hjälper bara till att få detta att hända. Om man avviker från systemet, genom att ignorera finansiella risker, lurar fattigdomen om hörnet.

Dokumentärfilmen "Överdos" (på engelska "Overdose") försöker kommunicera denna insikt, och lyckas bra, om den kan hålla kvar tittaren till andra halvan. Materialet i sin helhet är bra: Det består av

  • Intervjuer med huvudsakligen amerikanska experter,
  • Animationer
  • Suggestiva bilder
  • En speaker

I den svenska versionen finns också en svensk textremsa.

Intervjuerna fungerar och varje person presenteras på ett sätt som ger trovärdighet och tyngd. Animationerna fungerar mycket bra och är i världsklass. Tyvärr så är de suggestiva bilderna i början av filmen inte så suggestiva, det är lite svenskt tungfotat över dem. Den svenska textningen är inte heller av så bra kvalitet, jämfört med den uttrycksförmåga intervjusubjekten visar. Jag föredrog att lyssna på engelskan istället.

TV-mediet är subjektivitetens högborg, och det gör att det tyvärr  ibland är själva hantverket som avgör om man ska tycka att en film som "Överdos" eller en Marxistisk-Leninistisk film om hur bra det är med revolutioner ska framstå som mest trovärdig.

Det är därför viktigt att kommunicera fakta i dokumentärfilmer. Det som fungerar bäst i TV-mediet är jämförelser. I barnprogrammet Fem Myror så pratar man om att Asta går före Beda, och Cecilia bakom Beda. I filmen överdos görs jämförelser som illustrerar hur mycket pengar som har pumpats in, men detta görs först i andra halva av filmen. Filmen skulle behöva klippas om så att dessa delar kommer först och hookar tittaren. Då har man etablerat en faktabas. Sedan kan man ta in nån dansk (Andreas Mol Daalsgaard?), britt, italienare eller fransos som är proffs på det där med känslor för att få upp suggestiviteten i bilderna för den rent emotionella delen.

Jag hoppas att denna film kommer att få en stor spridning, och om saker blir värre så kommer den att få det. Men det bästa är om den får en spridning snabbt, och då skulle ett varv till i redigeringen behövas tycker jag. Men jag håller inte för osannolikt att den blir en succé även i nuvarande form.

Johan Norberg (Författare, manus), Henrik Devell (producent) och Martin Borgs (Regissör, manus) tog emot på rad och skakade hand med alla som kom på galapremiären på Skandia i Stockholm igår.

Så här ser de ut framifrån, i samma ordning


Tromb på Skeppsbron för några minuter sedan

published Apr 27, 2010 04:14   by admin ( last modified Apr 27, 2010 04:14 )

En kraftig vindby som höll i sig i pass 40 sekunder svepte över Skeppsbron i Gamla Stan i Stockholm idag. Jag hann tyvärr inte få upp kameran, men dammet yrde och en och annan flagga slets loss. Jag uppskattar vindhastigheten till uppemot 40 m/s som mest, men jag är ingen expert på området.

Jag antar att det var någon typ av rotation och att det alltså var en tromb, ett lokalt yrväder.


Elektrisk koppvärmare för te

published Apr 25, 2010 02:22   by admin ( last modified Apr 25, 2010 02:22 )

Det vore trevligt att ha något som håller tekoppen eller tekannan varm. Innan inköp och testning kan det vara bra att sondera och fundera.

Det finns USB-drivna plattor man kopplar in i datorn som ska hålla en kopp te eller kaffe varm. En sådan jag tittade på på webben hade en effekt på 2,5W. Det är inte mycket. Bestämde mig för att gå till Amazon.com för att se recensioner för olika koppvärmare. Nästan alla USB-värmare får bottenbetyg där.

Det visar sig att de koppvärmare som får bra recensioner tycks ligga runt 20W i effekt, och är då inte USB-drivna, utan stoppas direkt i vägguttaget.

Each of the three are rated at 20W, 17W and 24W respectively.

Läs mer: Amazon.com: Customer Reviews: Electric Beverage Warmer

 

USB har om jag minns rätt 5 volt i sig, och ska man ha 20 Watt ur det så blir det 4 Ampere, vilket skulle ge en rätt tjock sladd, och förutom att bryta USB-specifikationen vad gäller strömmängd så skulle man bara kunna använda USB-uttag som har mycket stor strömleveransförmåga (direkt från nätagget). I andra fall så har man nog bara sönder sin dator.

Nja, det får nog blir en koppvärmare som går på det vanliga elnätet.  En komplikation är att ju mindre te man har kvar i koppen, desto varmare blir det, för dessa varmhållare brassar på med samma effekt.

Fast det jag helst skulle vilja ha är en manick som håller min tekopp i en konstant temperatur. Detta skulle kunna göras med en värmesensor inbyggd i koppen, som kommunicerar med värmelementet. Fast det blir komplicerat, då sensorn måste sitta långt ner för att funka även vid halvtom kopp, medan vid hel kopp så kanske den visar en annan temperatur än den vid ytan...

Nä, så här gör man, allt tevärmaren behöver veta är följande:

  • Hur mycket te det är i koppen, löser man med att bygga in en våg i basen på plattan
  • Vad temperaturen i rummet är, löser man med en temperatursensor i basen, eller en trådlös sensor som ju nu är vanligt med inom/utomhustermometrar,

Sedan så får man helt enkelt kalibrera den för den mugg man använder.

Sätt tekoppen på plattan när teet har den temperatur du vill ha (t ex 55 grader)

  • Vänta 20 min och notera temperaturen
  • Knappa in temperaturen i värmeplattan.

Värmeplattan kan nu räkna ut vilket wattantal den kommer att behöva. Om teet efter 20 minuter är 10 grader kallare, så kan plattan räkna ut hur mycket mer watt den kommer att behöva avge för att hålla temperaturen konstant.

Ja, och dessutom måste man ju ha vägt koppen utan te först så taran kan noteras, så att plattan vet hur mycket av vikten senare som är te.

Lyxigare modeller kan ha minne för flera koppar. Om man kopplar ihop värmeplattan med en webbkamera så kan den identifiera koppen ur minnet.

Jo, detta blev väl lite overkill, men mycket av det vi kanske idag tycker är overkill kommer att vara standard i framtidens hem och kontor, trots allt.

En annan variant är att ha en infraröd strålnings-sensor som bevakar temperaturen på ytan på teet i koppen. Det är nog den bästa vägen att gå. Mot Elfakatalogen... Eller vänta lite research:

 

Single waveband radiation thermometers are usually designed to measure the true temperature when they receive all the radiation from an object that has an emissivity effectively of 1.0, or under blackbody conditions. This occurs most often when the devices are being calibrated, since they are calibrated under simulated blackbody conditions. The accuracy of the simulation bears much on the uncertainty of the calibration of the device. When these devices are used under effectively blackbody conditions, and their emissivity correction is set at 1.0, they can measure very accurately, indeed.



Läs mer: Noncontact Temperature Sensors-An index to infrared temperature sensor technical information categorized by specific sensor type.

 

Är ytan på teet en black body? Nära nog kanske. Så nu behövs en arm som går ut upp och över koppen, för att läsa temperaturen på ytan, och så en tyristor i någon krets som kommunicerar med sensorn och reglerar effekten. En termometer som mäter på avstånd kallas pyrometer. Ok, kan nån bygga det här? :-)


"svnadmin load" loads into an existing repository; it does not create one

published Apr 20, 2010 07:47   by admin ( last modified Apr 20, 2010 07:47 )

  • svnadmin dump repository > repository.svndump
  • svnadmin create repository
    svnadmin load repository < repository.svndump

I needed to downgrade a couple of repositories from format version 3 to 2 in order to work with RHEL, and it took me a while to realise that svnadmin load loads into an existing repository, it does not create a new one. So first create the repository with svnadmin create, then load into it.


Länk - "Fel" mikroorganismer bakom allergier?

published Apr 19, 2010 12:43   by admin ( last modified Apr 19, 2010 12:43 )

 

"These parallels suggest that unidentified differences in exposure to microbial communities in the industrialized world may have fundamentally changed human immune responses, thereby enhancing susceptibility to autoimmune and allergic diseases," say the researchers.



Läs mer: Bacteria in household dust may help or hinder childhood asthma


Det är ju också ett sätt att sälja in EU olika i olika länder

published Mar 31, 2010 08:06   by admin ( last modified Mar 31, 2010 08:06 )

Asymmetrisk översättning - samma deklaration har lite olika innehåll på olika språk, för att passa bättre med respektive lands föväntningar. Låter inte helt legalt.

The Irish and Dutch objected, saying that the term would alarm their voters. So in a typical compromise it was subjected to what the president of the European Council, Herman Van Rompuy, calls “asymmetric translation”. A French-language declaration talks of gouvernement économique. But the English version calls for enhanced “economic governance”.



Läs mer: Bailing out Greece: Smoke and mirrors | The Economist


An open, distributed social networking system

published Mar 20, 2010 12:09   by admin ( last modified Mar 20, 2010 12:09 )

Here are some thoughts on how a open, distributed social networking system might work:

 

Each participant in the social network has her own server. This server does not need to be physically where that user is, and it does not even need to be its own server process. However it needs to be a piece of the Internet that he user has sole control over and where:

  • She can store relationship information as a signed piece of text, that contains the user's OpenID url, the other person's OpenID url, and the type of relationship
  • She can control who has the right to view what information

 

An example

Alice is friends with Bob. She has signed a relationship declaration, which is just a piece of text containing her OpenID url and Bob's OpenID url and the text "friend with" and stored it on her server. She has also signed it with her cryptographic key.

Now a guy named Charlie comes surfing to Alice's server, and is automatically logged in with his OpenID. Alice has give Charlie the right to see what relationships she has, so Charlie can see Alice is friends with Bob. Charlie thinks he knows Bob. He realises this from the information about Bob (A photo, and a short text describing him). Alice's site has that information on Bob because her server fetched that from Bob's server, or because she had a picture of Bob. If it was taken from Bob's server, Bob had granted Alice's server the right to fetch the information first.

Charlie wants to declare friendship with Bob, and via Bob's OpenID url looks up Bob's server. Charlie cannot view much on Bob's site so he simply posts a request for friendship with Bob, at the same time granting Bob the right so see some basic info on Charlie on Charlie's server. Charlie also signs a friendship declaration with Bob and stores it on his own server, signed with his own key, just as Alice did with Bob on her server.

Bob is notified by his server that a guy named Charlie wants to be friends. Bob views Charlie's personal info, and maybe Charlie also has sent a proof that he already is friends with Alice. Bob now sings his friendship declaration and now Bob and Charlie are registered as friends, since both have signed a friendship declaration (Although each only stores their signed version of it).

Software needed for this to work

Not much, there needs to ne OpenID servers and they already exist. The OpenID url needs to have metadata in the form of a url to the personal server of that user.

There needs to be a way to sign information that can be verified to have been signed by e.g. you, and that also exists.

There needs to be a server that different people can be given different rights on the owner on what to view, based on their Open ID url

As an example, Plone with the plonesocial.auth.rpx plugin could be used to control who gets to see what on a server, GPG to sign stuff and MyOpenID.com to store metadata on where a server is. I am sure there are many other combinations.

Are there any products like this underway?


Freudiansk felläsning

published Mar 19, 2010 08:21   by admin ( last modified Mar 19, 2010 08:21 )

 



De har glömt ett "på" nu ser jag. Från förstasidan, själva artikeln här:

Hans roll som trappern Davy Crockett i en Disneyproducerad tv-serie gjorde honom till storstjärna över en natt i mitten av 1950-talet och


Läs mer: Skådespelaren Fess Parker död - Dödsfall - Sydsvenskan - Nyheter dygnet runt


How to place your public ssh key on a remote machine with one command

published Mar 18, 2010 03:16   by admin ( last modified Mar 18, 2010 03:16 )
ssh-copy-id remote-machine

 

This one-liner copies your public-key, that you generated with ssh-keygen (either SSHv1 file identity.pub or SSHv2 file id_rsa.pub) to the remote-machine and places it in ~/.ssh/authorized_keys file. This ensures that the next time you try to log into that machine, public-key authentication (commonly referred to as “passwordless authentication.”) will be used instead of the regular password authentication.



Read more: Top Ten One-Liners from CommandLineFu Explained - good coders code, great reuse


Two stars in python "**", what do they do?

published Mar 18, 2010 02:10   by admin ( last modified Mar 25, 2016 11:30 )

Searching for "**" on Google does not give much.

The two stars prefix in python converts between dictionaries and named arguments.

>>> def twoargs(one=None,two=None):
...     return (two,one)

The above function takes two named arguments, "one" and "two".

However it can still be called as if the arguments were just positional:

>>> twoargs(32,3)
(3, 32)

And it can be called with named arguments:

>>> twoargs(two=32,one=3)
(32, 3)

But, what if we call it with a dictionary as a parameter?

>>> adict = {'one':3232,'two':886}
>>> twoargs(adict)
(None, {'two': 886, 'one': 3232})

The dictionary will be assigned positionally to the first argument ("one"). Since the function happens to return its arguments in reverse order, we first get None for the the last argument in, and then the dictionary.

However if we put two stars in front of the dictionary when calling the function, the dictionary is transformed into named arguments

>>> twoargs(**adict)
(886, 3232)

This showed a function with two named arguments, called with the two stars prefix. One can also do it the other way around, that is put the stars in the arguments in the function definition:

>>>
>>> def someargs(**args):
...     return args

The above function will take any number of named arguments, and put them into a dictionary called "args".

>>> someargs(one=323)
{'one': 323}

It doesn't like positional arguments:

>>> someargs(323)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: someargs() takes exactly 0 arguments (1 given)

For positional arguments one can use the single star prefix.

So, when the two stars are used calling a function:

  • They convert a dictionary into named arguments

 

When the two stars are used in the function definition:

  • They convert named arguments into a dictionary