Left-Aligned | Center Aligned | Right Aligned |
---|---|---|
col 3 is | some wordy text | $1600 |
col 2 is | centered | $12 |
zebra stripes | are neat | $1 |
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
set nohud | |
map h J | |
map l K | |
map c x | |
map C X | |
set cncpcompletion | |
let barposition = "bottom" | |
set typelinkhints | |
set noautofocus |
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
# logging_example.py | |
import logging | |
# Create a custom logger | |
logger = logging.getLogger(__name__) | |
# Create handlers | |
c_handler = logging.StreamHandler() | |
f_handler = logging.FileHandler('file.log') |
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
# copyed from http://code.activestate.com/recipes/522995-priority-dict-a-priority-queue-with-updatable-prio/ | |
from heapq import heapify, heappush, heappop | |
class priority_dict(dict): | |
"""Dictionary that can be used as a priority queue. | |
Keys of the dictionary are items to be put into the queue, and values | |
are their respective priorities. All dictionary methods work as expected. | |
The advantage over a standard heapq-based priority queue is | |
that priorities of items can be efficiently updated (amortized O(1)) |
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: https://stackoverflow.com/questions/12753805/type-converting-slices-of-interfaces | |
// make any slice to interface{} slice | |
func InterfaceSlice(slice interface{}) []interface{} { | |
s := reflect.ValueOf(slice) | |
if s.Kind() != reflect.Slice { | |
panic("InterfaceSlice() given a non-slice type") | |
} | |
ret := make([]interface{}, s.Len()) |
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
class Pipe(object): | |
def __init__(self, func): | |
self.func = func | |
def __ror__(self, other): | |
def generator(): | |
for obj in other: | |
if obj is not None: | |
yield self.func(obj) | |
return generator() |
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: https://nbviewer.jupyter.org/github/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/blob/master/Chapter1_Introduction/Ch1_Introduction_PyMC3.ipynb | |
import scipy.stats as stats | |
from matplotlib import pyplot as plt | |
import numpy as np | |
a = np.linspace(0, 4, 100) | |
expo = stats.expon | |
lambda_ = [0.5, 1] | |
for l, c in zip(lambda_, colours): |
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 numpy as np | |
import matplotlib.pyplot as plt | |
import ipywidgets as widget | |
from sklearn.datasets import make_blobs | |
from sklearn.svm import SVC | |
def plot_svc_decision_function(model, ax=None, plot_support=True): | |
"""Plot the decision function for a 2D SVC""" | |
ax = ax or plt.gca() |
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
def f(x, y): | |
return np.sin(x) ** 10 + np.cos(10+x*y) + np.cos(x) | |
x = np.linspace(0, 5, 50) | |
y = np.linspace(0, 5, 50) | |
X, Y = np.meshgrid(x, y) | |
Z = f(X, Y) | |
# draw contour | |
contour = plt.contour(X, Y, Z, 3, colors='black') |
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
""" | |
Add copy to clipboard from IPython! | |
To install, just copy it to your profile/startup directory, typically: | |
~/.ipython/profile_default/startup/ | |
Example usage: | |
%clip hello world | |
# will store "hello world" |
NewerOlder