Skip to content

Instantly share code, notes, and snippets.

@anddam
anddam / mergelistdict.py
Created March 10, 2017 14:04
merge lists of dicts in single dictionary
from datetime import date
from itertools import chain
from collections import defaultdict
list_a = [
{'date': date(2017, 2, 23), 'count': 653442},
{'date': date(2017, 2, 24), 'count': 1923518},
{'date': date(2017, 3, 9), 'count': 8167},
{'date': date(2017, 3, 10), 'count': 38},
]
$ ls -l /usr/share/vim
total 12
drwxr-xr-x 6 root root 4096 Mar 7 16:45 addons
lrwxrwxrwx 1 root root 15 Nov 24 21:56 gvimrc -> /etc/vim/gvimrc
drwxr-xr-x 2 root root 4096 Mar 7 16:45 registry
drwxr-xr-x 17 root root 4096 Feb 10 08:41 vim74
lrwxrwxrwx 1 root root 8 Feb 10 07:41 vimfiles -> /etc/vim
lrwxrwxrwx 1 root root 14 Nov 24 21:56 vimrc -> /etc/vim/vimrc
lrwxrwxrwx 1 root root 19 Nov 24 21:50 vimrc.tiny -> /etc/vim/vimrc.tiny
# All comprehension approach
data = {percentage: [multiple_toss(times=times,
steps=step,
percentage=percentage,
factor=factor,
balance=balance
)
for step in range(step_limit)
]
$ cat /etc/auto.nfs
backup -fstype=nfs4 homeserver.local:/srv/backups/Laptop
$ cat /etc/auto.master | grep -v "^#"
/nfs /etc/auto.nfs
+dir:/etc/auto.master.d
+auto.master
@anddam
anddam / macos.out
Last active March 3, 2017 09:37
DIfferene in NFS directories and exports
$ showmount -3ed brados.local
Directories on brados.local:
/srv/backups
Exports list on brados.local:
/srv/foo *
/srv/backups/TimeMachine *
$ sudo dpkg -i mfc250clpr-1.1.2-2.i386.deb
Selecting previously unselected package mfc250clpr:i386.
(Reading database ... 306797 files and directories currently installed.)
Preparing to unpack mfc250clpr-1.1.2-2.i386.deb ...
Unpacking mfc250clpr:i386 (1.1.2-2) ...
Setting up mfc250clpr:i386 (1.1.2-2) ...
mkdir: cannot create directory ‘/var/spool/lpd/mfc250c’: No such file or directory
chown: cannot access '/var/spool/lpd/mfc250c': No such file or directory
chgrp: cannot access '/var/spool/lpd/mfc250c': No such file or directory
chmod: cannot access '/var/spool/lpd/mfc250c': No such file or directory
[ 645.454147] usb 1-2: new high-speed USB device number 6 using xhci_hcd
[ 645.604846] usb 1-2: New USB device found, idVendor=067b, idProduct=2773
[ 645.604860] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 645.604870] usb 1-2: Product: ATAPI-6 Bridge Controller
[ 645.604879] usb 1-2: Manufacturer: Prolific Technology Inc.
[ 645.604887] usb 1-2: SerialNumber: 0123456789000000005
[ 645.701780] usb-storage 1-2:1.0: USB Mass Storage device detected
[ 645.701957] scsi host2: usb-storage 1-2:1.0
[ 645.702124] usbcore: registered new interface driver usb-storage
[ 645.728110] usbcore: registered new interface driver uas
$ tmuxa
Traceback (most recent call last):
File "/home/anddam/.local/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 12437, in run
r = self.f(self.args, sp_stdin, sp_stdout, sp_stderr, spec)
File "/home/anddam/.local/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 12266, in proxy_two
return f(args, stdin)
File "/home/anddam/.xonshrc", line 30, in _tmuxa
![tmux attach] || ![tmux new-session]
File "/home/anddam/.local/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 18340, in subproc_captured_hiddenobject
return run_subproc(cmds, captured='hiddenobject')
@anddam
anddam / rhythmbox-debug.out
Created February 23, 2017 13:46
Rhythmbox not seeing iPod 2G device
unable to find device path for mount point /run/user/1000/gvfs/afc:host=ddc4a51291f21763f71044bf75c8afc6659d1b2f,port=3
unable to find device /run/user/1000/gvfs/afc:host=ddc4a51291f21763f71044bf75c8afc6659d1b2f,port=3 in udev
finding mount point for /run/user/1000/gvfs/afc:host=ddc4a51291f21763f71044bf75c8afc6659d1b2f,port=3
unable to find mount point for device path /run/user/1000/gvfs/afc:host=ddc4a51291f21763f71044bf75c8afc6659d1b2f,port=3
unable to find device path for mount point /run/user/1000/gvfs/gphoto2:host=%5Busb%3A001%2C004%5D
unable to find device /run/user/1000/gvfs/gphoto2:host=%5Busb%3A001%2C004%5D in udev
finding mount point for /run/user/1000/gvfs/gphoto2:host=%5Busb%3A001%2C004%5D
unable to find mount point for device path /run/user/1000/gvfs/gphoto2:host=%5Busb%3A001%2C004%5D
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2016/02/01>
Babel <3.9q> and hyphenation patterns for 3 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texmf/tex/latex/lm/lmodern.sty)