Skip to content

Instantly share code, notes, and snippets.

View asford's full-sized avatar

Alex Ford asford

View GitHub Profile
[alias]
### Log formatting
#
# Commit graph
llog = log --pretty=format:'%x09%C(auto)%h %d %<(80,trunc)%s' --graph
# Short commit graph, abbreviated by reference
slog = log --pretty=format:'%x09%C(auto)%h %d %<(80,trunc)%s' --graph --simplify-by-decoration
# Upstream log
ulog = log --pretty=format:'%x09%C(auto)%h %d %<(80,trunc)%s' --graph @ @{u}
@asford
asford / gist:5476a49305214231349e7181a8aec20e
Created December 29, 2018 10:19
C++14 Compatible Tuple Operator Broadcast
#include <tuple>
#include <utility>
namespace internal
{
template<typename T, typename T2, size_t... Is>
void add_rhs_to_lhs(T& t1, const T2& t2, std::integer_sequence<size_t, Is...>)
{
auto l = { (std::get<Is>(t1) += std::get<Is>(t2), 0)... };
(void)l;
@asford
asford / gist:b87d2f67115989692210a5690f7c6ec3
Last active December 29, 2018 09:54
C++17 Tuple Operator Overloads
// Fold expressions from https://medium.com/@matt.aubury/rip-index-sequence-2014-2017-9cc854aaad0
`
template <typename... Ts, typename... Us>
auto operator+(
const std::tuple<Ts...> &tuple_t, const std::tuple<Us...> &tuple_u) {
return std::apply(
[&](const auto &... ts) {
return std::apply(
[&](const auto &... us) { return std::tuple(ts + us...); },
tuple_u);
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
gistup
+fordas@fela:~/workspace/pose_fork_depickle$ gdb
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
[...]
+(gdb) file python
:(gdb) run pose_serial_fork_bug.py fullsize1.pdb
Starting program: /home/fordas/workspace/pose_fork_depickle/.conda/bin/python pose_serial_fork_bug.py fullsize1.pdb
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
conda
@asford
asford / sympy_invoke.ipynb
Last active August 21, 2018 01:41
Futzing about with "symbolic function invocation" via sympy.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"machine_info": {
"node": "hsw215.internalnet",
"processor": "x86_64",
"machine": "x86_64",
"python_compiler": "GCC 7.2.0",
"python_implementation": "CPython",
"python_implementation_version": "3.6.6",
"python_version": "3.6.6",
"python_build": [