If you don't use unison to keep folders synchronized you really should, it's great. It's like a two way rsync program. Problem is I end up synchronizing a bunchy of folders in different locations for different projects and I prefer to start unison at the command-line. What I want is bash completion for unison. It's not that difficult to setup. I just created a file in /etc/bash_completion.d called "unison" and it looks like this: _unison() { local cur prev opts COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" opts=$(python -c 'import glob,os,os.path;x = glob.glob(os.path.expanduser("~/.unison/*.prf")); print " ".join([os.path.split(y)[-1][:-4] for y in x])') COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 } complete -F _unison unison-gtk The python part is all one line and it goes to my ~/.unison folder, lists all the *.prf files and then just gets
Mark Byer's site has some more Sudoku solvers here's a short one in Python that's only 178 bytes long: def r(a):i=a.find('0');~i or exit(a);[m in[(i-j)%9*(i/9^j/9)*(i/27^j/27|i%9/3^j%9/3)or a[j]for j in range(81)]or r(a[:i]+m+a[i+1:])for m in'%d'%5**18] from sys import*;r(argv[1]) On the site is also shown a longer Perl version at 185 bytes: use integer;sub R{for$i(grep!$A[$_],@x=0..80){%t=map{$_/27-$i/27|$_%9/3-$i%9/3&&amp;amp;$_ /9-$i/9&&($_-$i)%9?0:$A[$_]=>1}@x;R($A[$i]=$_)for grep!$t{$_},1..9;return$A[$i]=0} die@A}@A=split//,<>;R I think the Python version is slightly easier to understand, although they are both quite cryptic. I'm not sure why I find these programs fascinating. I think it reminds me that any program can be written in such a way that it's cryptic, even in Python. In addition, the code is small enough that you should be able to figure out how it works, and may learn something the process. Related is
Tesla Model 3 Pros/Cons Cons The doors and trunk often need to be slammed to make sure they are closed properly. The frunk can't be closed without getting smudge marks on the hood. The bluetooth software to unlock your car doesn't work quickly every time, although it's mostly Android's fault. Parts of the central screen can be hard to read. It's expensive. Pros The supercharger network is the best in the world. Fast and cheap and so easy to use, and is a key selling point. The car's acceleration is instant and so addictive. Brings a smile every day! The traction control is unbelievably good. The handling and suspension are really good. Probably the safest car on the road. The whole car, and not just certain parts, can be fixed over the air by Tesla. Some days I wake up and the car can do new things. The car is connected to the Internet, for free! The battery will basically last forever, because Tesla protects it with careful software an
Comments