Skip to content

Instantly share code, notes, and snippets.

@anddam
anddam / test.py
Last active January 3, 2017 10:27
#!/usr/bin/env python
# Read all tsv files from passed folder and average lines 469:535, take index from file name
from sys import argv, exit
from os import listdir
from pandas import DataFrame, read_csv
from datetime import datetime
try:
E355P E355S
3327.0 1126.0
3327.0 1126.0
3687.0 1144.0
4436.0 1324.0
grid = [['.', '.', '.', '.', '.', '.'],
['.', 'O', 'O', '.', '.', '.'],
['O', 'O', 'O', 'O', '.', '.'],
['O', 'O', 'O', 'O', 'O', '.'],
['.', 'O', 'O', 'O', 'O', 'O'],
['O', 'O', 'O', 'O', 'O', '.'],
['O', 'O', 'O', 'O', '.', '.'],
['.', 'O', 'O', '.', '.', '.'],
['.', '.', '.', '.', '.', '.'],]
anddam@bibook /opt/macports/ports-git master $ /usr/bin/git pull --rebase upstream master
remote: Counting objects: 244, done.
remote: Compressing objects: 100% (142/142), done.
remote: Total 244 (delta 114), reused 54 (delta 54), pack-reused 40
Receiving objects: 100% (244/244), 182.93 KiB | 0 bytes/s, done.
Resolving deltas: 100% (115/115), completed with 32 local objects.
From github.com:macports/macports-ports
* branch master -> FETCH_HEAD
9ce3c03..41fad2d master -> upstream/master
First, rewinding head to replay your work on top of it...
@anddam
anddam / output.sh
Last active December 26, 2016 20:55
anddam@bibook /opt/macports/ports-git master $ git pull --rebase
Current branch master is up to date.
anddam@bibook /opt/macports/ports-git master $ port -d sync
---> Updating the ports tree
Synchronizing local ports tree from file:///opt/macports/ports-local
Creating port index in /opt/macports/ports-local
Total number of ports parsed: 0
Ports successfully parsed: 0
Ports failed: 0
, {"inp": "git pull\n", "rtn": 1, "ts": [1482309128.985267, 1482309132.066719]
}
, {"inp": "git pull remote upstream\n", "rtn": 1, "ts": [1482309138.439869, 1482309138.633955]
}
, {"inp": "git pull upstream\n", "rtn": 1, "ts": [1482309146.976664, 1482309152.688904]
}
, {"inp": "git pull upstream master\n", "rtn": 128, "ts": [1482309161.529076, 1482309164.844261]
}
, {"inp": "cd /opt/macports/ports\n", "rtn": 0, "ts": [1482309756.327485, 1482309756.33121]
}
# coding: utf-8
class Test:
def __init__(self, seed=0):
self.seed = seed
def __hash__(self):
return seed
def print_bits(seed):
print("{:0>64s}".format(bin(Test(seed).__hash__())[2:]))
print("{:0>64s}".format(bin(hash(Test(seed)))[2:]))
from pandas import DataFrame, concat
from numpy import nan
correct = DataFrame({'foo': ((1, 'a'), (2, 'b')),
'bar': ((nan, 123), (3, 7)),
'valid_1': (144, 169),
'valid_2': (12, 13)})
wrong = DataFrame({'foo': (),
'bar': (),
@anddam
anddam / vox.sh
Last active December 11, 2016 08:23
Xonsh locale error while creating new environment with vox, manually running the command seems to work with correct LANG set but not vox itself.
anddam@bibook ~ bibook $ vox ls
No environments available. Create one with "vox new".
anddam@bibook ~ bibook $ vox new test
Creating environment...
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 9607, in wrapped_simple_command
r = f(args, i)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/xontrib/vox.py", line 154, in handle
return vox(args, stdin=stdin)
@anddam
anddam / output
Last active December 10, 2016 18:10
In [18]: %run semaphores.py
In [19]: working.size
Out[19]: 0
In [20]: len(working)
Out[20]: 0
In [21]: nonworking.size
Out[21]: 0