This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone --bare https://github.com/cvanelteren/dots.git $HOME/.cfg | |
function config { | |
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@ | |
} | |
mkdir -p .config-backup | |
config checkout | |
if [ $? = 0 ]; then | |
echo "Checked out config."; | |
else | |
echo "Backing up pre-existing dot files."; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SPC s c remove highlight | |
**** Files manipulations key bindings | |
Files manipulation commands (start with ~f~): | |
| Key Binding | Description | | |
|-------------+----------------------------------------------------------------| | |
| ~SPC f c~ | copy current file to a different location | | |
| ~SPC f C d~ | convert file from unix to dos encoding | | |
| ~SPC f C u~ | convert file from dos to unix encoding | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <pybind11/stl.h> | |
#include <pybind11/pybind11.h> | |
#include <pybind11/operators.h> | |
namespace py = pybind11; | |
using namespace pybind11::literals; | |
using namespace std; | |
template<typename T> | |
class Property{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from subprocess import run | |
from multiprocessing import cpu_count | |
import os, click | |
@click.command() | |
@click.option('--source', default = "~/Phd/ereader") | |
@click.option('--target', default = "~/Calibre Library") | |
@click.option('--args', default = f"-as -w -ocr -nt {cpu_count()} -ocr -x -ui-") | |
def run_reader(source, target, args): | |
eReaderConverter(source, target, args).convert() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from vispy.visuals.graphs.util import _straight_line_vertices, issparse | |
import networkx as nx, numpy as np | |
class NetworkxCoordinates: | |
def __init__(self, graph, layout = None, *args, **kwargs): | |
self.graph = graph | |
self.positions = np.zeros((len(graph), 2), dtype = np.float32) | |
# default random positions | |
if type(layout) is type(None): | |
self.positions = np.random.rand(*self.positions.shape) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test-microphone() { | |
arecord -vvv -f dat /dev/null | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Original by Jake VanderPlas | |
# https://gist.github.com/jakevdp/91077b0cae40f8f8244a | |
# License: BSD-style | |
# cvanelteren: small edit since the original was not compatible with latest mpl | |
import matplotlib.pyplot as plt, numpy as np | |
def discrete_cmap(N, base_cmap=None): | |
"""Create an N-bin discrete colormap from the specified input map""" | |
# Note that if base_cmap is a string or None, you can simply do | |
# return plt.cm.get_cmap(base_cmap, N) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, time | |
class progbar: | |
def __init__(self, x, stream = sys.stdout, | |
char = "#"): | |
self.x = x | |
self.stream = stream | |
self.char = char | |
def __iter__(self): | |
self.n = len(self.x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mpl_toolkits.mplot3d import axes3d | |
import matplotlib.pyplot as plt | |
from mpl_toolkits.mplot3d.art3d import Line3DCollection | |
fig, ax = plt.subplots(subplot_kw = dict(projection = '3d')) | |
# generate data | |
x = np.linspace(-5, 5, 500) | |
y = np.linspace(-5, 5, 500) | |
z = np.exp(-(x - 2)**2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt, cmasher as cmr | |
import numpy as np | |
layout = np.zeros((10, 10), dtype = object) | |
layout[-1, :] = np.arange(1, 11) | |
layout[:, -1] = np.arange(20, 30) | |
fig = plt.figure(constrained_layout = 1) | |
axs = fig.subplot_mosaic(layout) | |
ax = axs.get(-1) |
OlderNewer