Skip to content

Instantly share code, notes, and snippets.


Ivan Krukov ivan-krukov

  • Canada
View GitHub Profile
View emacs-animations.el
;; animations
;; Requires =emacs-mac= fork
;; repo:
;; homebrew tap:
;; Crazy example
(mac-start-animation nil :type 'page-curl-with-shadow
:duration 1.0 :direction 'right :angle 45)
;; Less crazy
(mac-start-animation (selected-window) :type 'move-out
ivan-krukov /
Last active May 12, 2020
Show opencv image in ipython notebook
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 / modal-view.el
Last active Mar 26, 2020
Personal setup for modal navigation with view mode
View modal-view.el
;; add view mode keybindings
(use-package view
:config (setq view-read-only t) ;; C-x C-q can also toggle view-mode
:straight nil
:bind (("<f13>" . view-mode) ;; remap R-Shift to F 13
:map view-mode-map
("n" . forward-line)
("p" . previous-line)))
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 /
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
#!/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 /
Created Mar 20, 2018
Rename a bunch of files by zero padding
# create
for ((i = 1; i <= N; i++)); do
touch e-$i.csv
# rename
# note %04d - pad to 4 zeros
for ((i = 1; i <= N; i++)); do
ivan-krukov /
Created Nov 5, 2013
Using Perl Inline::CPP and perlapi to pass around array data
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";
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>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Elementary observables</title>
<script src=""></script>
<button id='error'>Will throw</button>
View bootstrap.R
# bootstrap.R
cat("Loading packages\n")
cat("Loading data\n")
You can’t perform that action at this time.