Skip to content

Instantly share code, notes, and snippets.

Ivan Krukov ivan-krukov

  • Canada
Block or report user

Report or block ivan-krukov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View pair_picks.py
import numpy as np
from collections import Counter, defaultdict
def __f(x, i, j):
'''Consume a state to generate a sequence of haplotypes picked'''
pairs = []
y = x.copy()
while True:
@ivan-krukov
ivan-krukov / jupyter-imshow.py
Last active Mar 30, 2019
Show opencv image in ipython notebook
View jupyter-imshow.py
import cv2
import urllib.request
# Will use matplotlib for showing the image
from matplotlib import pyplot as plt
# Plot inline
%matplotlib inline
# For local images, read as usual
@ivan-krukov
ivan-krukov / ftp-download.py
Created Jun 6, 2013
Complete download file over FTP example. Complete with write-report closure in python3 style, writing stdout to same line and nice verbosity handling
View ftp-download.py
#!/usr/bin/env python3
from ftplib import FTP
def ftp_download(server,remote_path,local_path,username="anonymous",password="",verbose=True):
#new ft object
ftp = FTP(server)
if verbose: print("Connected to %s"%server)
#notice that default login is "anonymous" with no password. works on most public servers
@ivan-krukov
ivan-krukov / pad-rename.sh
Created Mar 20, 2018
Rename a bunch of files by zero padding
View pad-rename.sh
N=100
# create
for ((i = 1; i <= N; i++)); do
touch e-$i.csv
done
# rename
# note %04d - pad to 4 zeros
for ((i = 1; i <= N; i++)); do
@ivan-krukov
ivan-krukov / perl-cpp-arrays.pl
Created Nov 5, 2013
Using Perl Inline::CPP and perlapi to pass around array data
View perl-cpp-arrays.pl
#!/usr/bin/perl
use warnings;
#not sure how to use strict here - does not allow bareword in "Inline CPP"
use Inline CPP;
my @data = (0..10);
my $result_ref = do_stuff(\@data);
my @result = @$result_ref;
print "@result\n";
__END__
__CPP__
@ivan-krukov
ivan-krukov / .vimrc
Created Sep 20, 2017
vimrc for Vim 8
View .vimrc
" Plugins {{{
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdcommenter'
Plug '/usr/local/opt/fzf' | Plug 'junegunn/fzf.vim'
Plug 'christoomey/vim-tmux-navigator'
Plug 'chriskempson/base16-vim'
Plug 'sheerun/vim-polyglot'
Plug 'fatih/vim-go'
Plug 'SirVer/ultisnips'
Plug 'scrooloose/nerdtree'
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Elementary observables</title>
</head>
<body>
<script src="https://unpkg.com/@reactivex/rxjs@5.0.3/dist/global/Rx.js"></script>
<button id='error'>Will throw</button>
View bootstrap.R
# bootstrap.R
cat("Loading packages\n")
library(tidyverse)
library(RefFreeEWAS)
library(qvalue)
cat("Loading data\n")
load("pdat.merge.rdata")
load("betas.rdata")
View Default.sublime-keymap
[
// Align
{ "keys": ["super+.", "super+a"], "command": "alignment" },
// Surround
{ "keys": ["super+.", "super+s", "super+s"], "command": "surround_selection"},
{ "keys": ["super+.", "super+s", "super+d"], "command": "surround_delete"},
{ "keys": ["super+.", "super+s", "super+c"], "command": "surround_change"},
// Expand selection
{ "keys": ["super+shift+'"], "command": "expand_selection_to_quotes"},
{ "keys": ["super+shift+;"], "command": "expand_selection", "args": {"to": "scope"}},
@ivan-krukov
ivan-krukov / README.md
Created Sep 5, 2016
Metropolis Beamer theme framesubtitle
View README.md

Metropolis framesubtitle

This is an attempt to have frame subtitle support for the Metropolis Beamer theme. Since there is no native support in the theme itself, this is somewhat of a hack.

This adds an extra beamercolorbox, equivalent to a frametitle box, but with a different name.

You can’t perform that action at this time.