Skip to content

Instantly share code, notes, and snippets.

View ivan-krukov's full-sized avatar
🗃️
Getting there

Ivan Krukov ivan-krukov

🗃️
Getting there
View GitHub Profile
@ivan-krukov
ivan-krukov / emacs-animations.el
Created April 25, 2020 01:19
Emacs-mac animations
;; animations
;; Requires =emacs-mac= fork
;; repo: https://bitbucket.org/mituharu/emacs-mac
;; homebrew tap: https://github.com/railwaycat/homebrew-emacsmacport
;; 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
ivan-krukov / modal-view.el
Last active March 6, 2023 12:11
Personal setup for modal navigation with view mode
;; 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
ivan-krukov / pad-rename.sh
Created March 20, 2018 16:43
Rename a bunch of files by zero padding
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 / .vimrc
Created September 20, 2017 16:06
vimrc for Vim 8
" 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'
@ivan-krukov
ivan-krukov / index.html
Created June 30, 2017 16:45
Elementary observables // source https://jsbin.com/xekubas
<!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/[email protected]/dist/global/Rx.js"></script>
<button id='error'>Will throw</button>
@ivan-krukov
ivan-krukov / bootstrap.R
Last active June 5, 2017 19:23
Volcano plots
# bootstrap.R
cat("Loading packages\n")
library(tidyverse)
library(RefFreeEWAS)
library(qvalue)
cat("Loading data\n")
load("pdat.merge.rdata")
load("betas.rdata")
[
// 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 September 5, 2016 18:12
Metropolis Beamer theme framesubtitle

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.

@ivan-krukov
ivan-krukov / grep_operator.Rmd
Last active June 7, 2016 00:16
Simpler logical subsetting by strings with `grep`
```{r, echo=FALSE}
library(magrittr)
```
# `%grep%` operator
Using `R`'s built-in `grep` function is really inconvenient for interactive work.
There already exists a convenient `%in%` operator for testing membership in a sequence.
However, real data analysis rarely presents with well-defined sequences.
Strings are much more common.