Skip to content

Instantly share code, notes, and snippets.

View epogrebnyak's full-sized avatar

Evgeny Pogrebnyak epogrebnyak

View GitHub Profile
@ljvmiranda921
ljvmiranda921 / Makefile
Last active September 10, 2018 10:58
Contains a minimal workflow for compiling LaTeX documents
# A Simple Makefile for LaTeX
# Author: Lester James V. Miranda
# E-mail: ljvmiranda@gmail.com
# Default variables which can be edited via the terminal
BUILDDIR = _build
COMPILER = pdflatex
PROJECT = main
BIBLIOGRAPHY = bibliography
@uiur
uiur / parse.hs
Created November 22, 2011 19:52
Haskellの練習: Monadic parser combinator using Maybe
-- プログラミングHaskellのパーサコンビネータの実装をMaybeモナドを使うようにしてみた
-- Programming in Haskell : 8 Chapter
module Parsing where
import Char
import Monad
infixr 5 +++
newtype Parser a = Parser {getParser :: String -> Maybe (a,String)}
@milibopp
milibopp / mpl_multipage_pdf.py
Last active December 17, 2019 21:29
Matplotlib multiple pages in PDF
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.backends.backend_pdf import PdfPages
with PdfPages('multipage.pdf') as pp:
for i in range(0, 10):
fig = plt.figure()
ax1 = fig.add_subplot(211)
ax2 = fig.add_subplot(212)
x = np.linspace(0, 10)
@avitale
avitale / totalsize.jl
Last active February 16, 2020 12:51
Total size of Julia objects
module Totalsizeof
importall Base
export totalsizeof
# Helper: Pointer cache is used to break circular references in objects and avoid double countings
is_seen!(x, ptr_cache) = in(pointer_from_objref(x), ptr_cache) || (push!(ptr_cache, pointer_from_objref(x)); false)
# Helper: Catch types without size method
sizeof_catch(x) = try sizeof(x) catch 0 end
@brantfaircloth
brantfaircloth / sphinx_to_github.sh
Created January 23, 2011 02:40
Sphinx documentation to github gh-pages without submodules
# assume the following directory structure where contents of doc/
# and source/ are already checked into repo., with the exception
# of the _build directory (i,e. you can check in _themes or _sources
# or whatever else).
#
# proj/
# source/
# doc/
# remove doc/_build/html if present
@peterkuma
peterkuma / server.py
Created February 10, 2014 14:22
A flask server for serving all JPEG images in a local directory and subdirectories. Uses unveil.js for lazy-loading of images. Thumbnails are created on the fly by PIL.
#!/bin/python
import os
from flask import Flask, Response, request, abort, render_template_string, send_from_directory
import Image
import StringIO
app = Flask(__name__)
WIDTH = 1000
@dutc
dutc / 1.py
Created March 3, 2021 02:50
`pandas` problem of the day: analysis (with `numpy.meshgrid`‽)
from pandas import Series
s = Series({
4: 89.00,
6: 109.99,
8: 149.14,
10: 218.99,
12: 239.09,
14: 279.99,
16: 329.99,
18: 409.99,
@jkoppel
jkoppel / jnettool.py
Created September 16, 2017 19:17
Example from Raymond Hettinger's talk, "Beyond PEP 8 -- Best practices for beautiful intelligible code - PyCon 2015"
# From "Raymond Hettinger - Beyond PEP 8 -- Best practices for beautiful intelligible code - PyCon 2015"
# Bad code
import jnettools.toolselements.NetworkElement, \
jnettools.tools.Routing, \
jnettools.tools.RouteInspector
ne=jnettools.tools.elements.NetworkElement( '171.0.2.45' )
try:
@asmedrano
asmedrano / readcsv.go
Created February 12, 2014 15:54
Go read csv
package main
import (
"encoding/csv"
"fmt"
"io"
"os"
)
// documentation for csv is at http://golang.org/pkg/encoding/csv/