Skip to content

Instantly share code, notes, and snippets.

@technic
technic / custom.css
Created January 10, 2019 22:35 — forked from felixlaumon/custom.css
My iPython / Jupyter notebook custom styling
@import url('http://fonts.googleapis.com/css?family=Crimson+Text');
@import url('http://fonts.googleapis.com/css?family=Source+Code+Pro');
/* Change code font */
.CodeMirror pre {
font-family: 'Input Mono Narrow', 'Source Code Pro', Consolas, monocco, monospace;
}
div.input_area {
border-color: rgba(0,0,0,0.10);
@technic
technic / mkl.py
Created January 24, 2019 16:09
MKL_NUM_THREADS python context manager
import ctypes
class MKLThreads(object):
_mkl_rt = None
@classmethod
def _mkl(cls):
if cls._mkl_rt is None:
try:
@technic
technic / lighten_color.py
Created January 30, 2019 16:32 — forked from ihincks/lighten_color.py
Function to lighten any color in matplotlib
def lighten_color(color, amount=0.5):
"""
Lightens the given color by multiplying (1-luminosity) by the given amount.
Input can be matplotlib color string, hex string, or RGB tuple.
Examples:
>> lighten_color('g', 0.3)
>> lighten_color('#F034A3', 0.6)
>> lighten_color((.3,.55,.1), 0.5)
"""
@technic
technic / Vagrantfile
Created January 31, 2019 14:26
for yocto oe
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# Based on Ubuntu 16.04
config.vm.box = "ubuntu/xenial32"
config.vm.provider "virtualbox" do |vb|
# Customize VirtualBox machine
@technic
technic / watch.py
Created September 5, 2019 14:56
Watch jupyter notebook changes and LiveReload slides
#!/usr/bin/env python
import sys
import os
import time
import logging
import argparse
import subprocess
import threading
import webbrowser
@technic
technic / slides.html.jinja2
Last active September 8, 2019 14:24
Jupyter slides template with code toggle button
{%- extends 'slides_reveal.tpl' -%}
{% block input_group -%}
<div class="input_wrapper">
{{ super() }}
</div>
{% endblock input_group %}
@technic
technic / ipywidgets_sugar.py
Created September 12, 2019 12:54
ipywidgets decorator with continuous_update = False
from ipywidgets import interact
def interact_delayed(**kwargs):
def decorator(f):
obj = interact(f, **kwargs)
for child in obj.widget.children:
if hasattr(child, 'continuous_update'):
child.continuous_update = False
return obj
return decorator
@technic
technic / main.cpp
Created September 14, 2019 20:15
TypeList
#include <iostream>
#include <limits>
#include <type_traits>
/**
* @brief Keep list of types provided by variadic template arguments.
* Provide constexpr function to get index of specific type in the list.
*/
template <typename... Ts> class TypeList {
@technic
technic / README.md
Last active September 19, 2019 06:40
Fast rust implementation for https://habr.com/ru/post/450512, reference C++ and Go implementations also present
@technic
technic / .bashrc
Last active October 25, 2019 10:04
Powershell profile
# ssh-agent
check-ssh-agent() {
test -S "$SSH_AUTH_SOCK" && {
ssh-add -l >& /dev/null
if [ $? -ne 2 ]; then
echo "ssh-agent is already running ($SSH_AUTH_SOCK)"
true
else
false
fi