Skip to content

Instantly share code, notes, and snippets.

View velppa's full-sized avatar
🎯
Focusing

Pavel Popov velppa

🎯
Focusing
View GitHub Profile
def initialize
@root_dir = File.expand_path(File.dirname(__FILE__) + '/../')
@options = Trollop::options do
opt :asdf,
:type => String,
:default => "#{@root_dir}/qwer"
end
@velppa
velppa / trollop.rb
Last active December 20, 2015 10:38
require 'trollop'
class Test
attr_reader :a
attr_reader :opts
def initialize
@a = 'qwer'
@opts = Trollop::options do
opt :monkey, "Use monkey mode" # a flag --monkey, defaulting to false
opt :goat, "Use goat mode", :default => true # a flag --goat, defaulting to true
__author__ = 'U_M0AZC'
import random
import matplotlib.pyplot as plt
def set_choices(doors=3):
correct_choice = -1
choices = [0 for i in range(doors)]
random.seed()
@velppa
velppa / Ashley.html
Created November 23, 2013 08:27
Ashley theme for Tumblr
<!DOCTYPE html>
<!--
Theme: Ashley v0.5
Author: Jxnblk [http://jxnblk.com]
For: Tumblr [http://tumblr.com/]
Terms: Protected under Creative Commons.
-->
<html lang="en">
nmap <buffer> <silent> ]] :call search('\\c^\\<select\\>', 'W' )<CR>
nmap <buffer> <silent> [[ :call search('\\c^\\<select\\>', 'bW' )<CR>
" abbreviations
iab <buffer> maxdate DATE'5999-12-31'
iab <buffer> select SELECT
iab <buffer> from FROM
iab <buffer> and AND
iab <buffer> or OR
iab <buffer> on ON
# rbd at mac-mini in ~/Sites/iseetheline.ru on git:master x [23:27:40]
$ python
Python 2.7.5 (default, Jun 8 2013, 12:45:21)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import timedelta as t
>>> x = t(days=3)
>>> y = t(days=2)
>>> (x-y)*0.5
Traceback (most recent call last):
@velppa
velppa / 3.hs
Last active August 29, 2015 13:58
Project Euler solutions
-- take step in eratosphen cell by removing all multipliers of x in xs
ec_step :: Integer -> [Integer] -> [Integer]
ec_step 1 xs = xs
ec_step x xs = [ j | j <- xs, mod j x /= 0 ]
-- eratosphen cell recursive
ec_recc :: ([Integer], [Integer]) -> ([Integer], [Integer])
ec_recc (ps, []) = (ps, [])
(ns ledger-reports.core
(:gen-class))
(require '[clojure.data.csv :as csv]
'[clojure.java.io :as io])
(defn read-csv
[filename]
(def csv
@velppa
velppa / ledger.ipynb
Created August 5, 2014 06:15
IPython notebook to compare multiple period in Ledger
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Notebook</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>