Skip to content

Instantly share code, notes, and snippets.

View slava-sh's full-sized avatar

Slava Shklyaev slava-sh

View GitHub Profile
@slava-sh
slava-sh / spots.ipynb
Last active March 6, 2017 20:04
AWS spot instance prices
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@slava-sh
slava-sh / compare.cpp
Last active October 21, 2015 19:06
Boolean function equivalence (SEERC 2015 Problem A)
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <exception>
#include <algorithm>
using namespace std;
const char NOT_SIGN = '~';
const char AND_SIGN = '^';
@slava-sh
slava-sh / signit.py
Created September 9, 2015 19:17
writeup draft
import socket
import operator
from termcolor import colored
from sympy.ntheory import primefactors
from functools import reduce
SIGNER = ('cry1.chal.mmactf.link', 44815)
VERIFIER = ('cry1.chal.mmactf.link', 44816)
S_PROMPT = colored('s', 'blue')

Keybase proof

I hereby claim:

  • I am slava-sh on github.
  • I am slava (https://keybase.io/slava) on keybase.
  • I have a public key whose fingerprint is D272 FA25 BA10 FA06 6723 082B 6163 5885 EE74 3F3B

To claim this, I am signing this object:

# -*- coding: utf-8 -*-
import random
from anki.hooks import addHook
def fmod_random(txt, extra, context, tag, fullname):
return random.choice([x.strip() for x in txt.split(',')])
addHook('fmod_random', fmod_random)
@slava-sh
slava-sh / Open_URL.py
Last active August 29, 2015 14:12
Anki add-on
# -*- coding: utf-8 -*-
from aqt import mw
from aqt.qt import *
def openUrl(url_template):
def inner():
url = url_template.format(**mw.reviewer.card.note())
QDesktopServices.openUrl(QUrl(url))
return inner
#!/bin/bash
FILE='/sys/class/backlight/intel_backlight/brightness'
VALUES=(500 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 11000 12000 12421)
DEFAULT=9
current=$(cat $FILE)
current=${current,,}
case "$1" in
@slava-sh
slava-sh / gist:7068414
Last active December 26, 2015 00:59
.zshrc
#!/bin/zsh
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# tmux on VT
[[ $TERM == linux ]] && test -z "$TMUX" && (tmux attach || tmux new-session)
# for autocomplete
alias sudo='sudo '
module Robot (Robot, robotName, mkRobot, resetName) where
import Control.Concurrent.MVar (MVar, newEmptyMVar, tryTakeMVar, putMVar)
import System.Random (StdGen, getStdRandom, randomR)
import Data.Maybe (fromMaybe)
import Control.Applicative ((<$>))
import Control.Arrow (first)
import Control.Monad (void)
type Name = String
newtype Robot = Robot (MVar Name)