start new:
tmux
start new with session name:
tmux new -s myname
| from StringIO import StringIO | |
| from lxml import objectify | |
| class SampleParser: | |
| def __init__(self, xml_data): | |
| tree = objectify.parse(xml_data) | |
| self.root = tree.getroot() | |
| def student_names(self): |
| import copy | |
| import os | |
| from lxml import objectify | |
| namespace = 'http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2' | |
| def remove_laps(): | |
| pass | |
| def count_laps(tree_root): |
| # virtualenv setup | |
| cd proj_folder | |
| virtualenv venv | |
| # or with a particular version of python | |
| virtualenv -p /usr/bin/python2.7 venv | |
| # Activate it | |
| source venv/bin/activate |
| p = [(1,2,3), (2,4), (1,6)] | |
| set(itertools.chain(*p)) | |
| => {1,2,3,4,5,6} | |
| where: | |
| *p expands the list elements into separate arguments | |
| itertools.chain() chains all of the individual elements of each parameter (the tuple from p in this case) into a single iterable stream. |
| Task | Command |
|---|---|
| Fetch for later merging | git fetch [remote name] |
| Pull and merge | git pull [remote name] |
| Pull and rebase local changes on top (instead of merging) | git pull --rebase [remote name] |
| Clone only a subset of files | git init repo cd repogit remote add origin urlgit config core.sparsecheckout trueecho "path/*" >> .git/info/sparse-checkoutgit pull --depth=1 origin master |
GNU Octave is a high-level interpreted language, primarily intended for numerical computations.
(via GNU Octave)
~=&&| def mpps(gbps, size): | |
| return (gbps / (size * 8)) * 1000 | |
| def gbps(mpps, size): | |
| return mpps * size * 8 / 1000; | |
| def pkt_size(gbps, mpps): | |
| return (gbps * 1000) / mpps / 8 | |
| ################################################## |
| #ifndef _TIMESTAMP_H_ | |
| #define _TIMESTAMP_H_ | |
| static inline uint64_t timestamp_start(void) | |
| { | |
| union { | |
| uint64_t tsc_64; | |
| struct { | |
| uint32_t lo_32; | |
| uint32_t hi_32; |