Skip to content

Instantly share code, notes, and snippets.

import argparse
import re
rule_regex = re.compile(r'^{$.*?^}$', re.DOTALL | re.MULTILINE)
def filter_suppressions(input_file, output_file):
Takes the output of Valgrind, run with `--gen-suppressions=all`
PeterMinin /
Created Jan 28, 2020
A kludge for a bug in old Eclipse versions where the Parameter Hints popup keeps getting smaller and closes if you try to resize it:
#! /usr/bin/env python3
import os
import re
workspace_path = os.environ['HOME'] + '/nsight-workspace'
plugin_name = 'org.eclipse.cdt.ui'
target_width = 800
target_height = 500
PeterMinin /
Last active Dec 4, 2019
Batch-assigning repository identities in Phabricator
#! /usr/bin/env python3
I made a mirror of a third-party repository in Phabricator to keep track
of changes in specific files using Owners. I'm still trying this workflow,
and I still have some issues with it that might need patching Phabricator
to solve, so I'm not sure I recommend doing this.
Anyway, importing the repository to Diffusion created a few hundred
#!/usr/bin/env python3
This is an installation/uninstallation utility for integrating
unpackaged software, i.e. that distributed as an archive rather than
a deb-package or an installation script, into the user's ~/.local/
directory structure, provided that the application still follows
the standard directory structure (with "bin", "share", etc.).
Installation is performed in the form of symbolic links, i.e.
PeterMinin / cloudSettings
Last active Aug 18, 2021
Visual Studio Code Settings Sync Gist
View cloudSettings
PeterMinin /
Last active Jun 14, 2017
For synchronizing ipyparallel engines with the controller client.
import ipyparallel as ipp
import types
ipp_client = ipp.Client()
ipp_direct = ipp_client[:]
def push_functions():
functions = {name: val
for name, val in globals().items()
if type(val) == types.FunctionType and val.__module__ == '__main__'}
PeterMinin /
Last active May 17, 2017
A function for reading .mat files from MATLAB v7.3+ in Python. Doesn't support all MATLAB types yet.
import h5py
import numpy as np
def convert_item(item, file):
cls = item.attrs['MATLAB_class'].decode('utf-8')
if cls == 'char':
return ''.join(map(chr, item))
elif cls == 'uint8':
return np.array(item, dtype=np.uint8)
View .bash_aliases
alias git-tree="git log --graph --full-history --all --color --pretty=format:\"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s\""
alias beep="echo -ne '\007'"
alias apt-install="sudo apt install $@"
View .tmux.conf
# Set prefix to Ctrl+A
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# Enable mouse interaction (for tmux version >= 2.1):
# select and resize panes, copy text and change window using the status line
set-option -g mouse on
# Scroll History
from time import time
class FpsCounter(object):
def __init__(self, period=1, period_in_seconds=True):
self.frame_counter = None
self.interval_start = None
self.period = period
self.period_in_seconds = period_in_seconds
self.total_seconds = 0
self.average = 0