Skip to content

Instantly share code, notes, and snippets.

View epogrebnyak's full-sized avatar

Evgeny Pogrebnyak epogrebnyak

View GitHub Profile
@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
@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)}
@ajmendez
ajmendez / age.py
Last active October 16, 2022 18:45
Here is a nice little wikipedia parser for grabbing an date of birth and date of death for a individual with an infobox template. This template is found generally on famous people. Works with people who are still alive by returning None for death_date.
import urllib2, json, pprint, re, datetime
import mwparserfromhell
def _parseDate(wikiDate):
''' Parse a mediawiki date template -- assumes years, month, day
Input:
a mwparser object containing just the date to be parsed
Returns:
datetime.date object of the date
'''
@chriscasola
chriscasola / README.txt
Last active June 13, 2022 08:30
A python script to generate a table of contents for a GitHub Flavored markdown file. The file must contain a level one header with a title that contains "Table of Contents". The script will generate a TOC containing all level 1, 2, and 3 headers.
A python script to generate a table of contents (with links) for a GitHub Flavored markdown file.
The file must contain a level one header with a title that contains "Table of Contents".
The script will generate a TOC containing all level 1, 2, and 3 headers.
Run the script like this:
python tocgen.py inFileName outFileName
BEFORE file:
--------------------------------------------------------
This is my GitHub wiki page.
@cobyism
cobyism / gh-pages-deploy.md
Last active April 18, 2024 13:44
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@iandanforth
iandanforth / kmeansExample.py
Last active October 5, 2023 12:35
A pure python implementation of K-Means clustering. Optional cluster visualization using plot.ly.
#############################################################################
# Full Imports
from __future__ import division
import math
import random
"""
This is a pure Python implementation of the K-means Clustering algorithmn. The
original can be found here:
@sloria
sloria / bobp-python.md
Last active April 20, 2024 13:02
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@rxaviers
rxaviers / gist:7360908
Last active April 26, 2024 15:35
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@kseo
kseo / CombinatorParser.hs
Created December 20, 2013 03:10
Monadic Parsing in Haskell
module CombinatorParser where
import Control.Monad
import Data.Char
-- FUNCTIONAL PEARLS: Monadic Parsing in Haskell
-- http://eprints.nottingham.ac.uk/223/1/pearl.pdf
newtype Parser a = Parser { parse :: (String -> [(a, String)]) }
@MikeInnes
MikeInnes / startup.jl
Last active February 5, 2023 12:54
Some useful macros for Julia
# Repeat an operation n times, e.g.
# @dotimes 100 println("hi")
macro dotimes(n, body)
quote
for i = 1:$(esc(n))
$(esc(body))
end
end
end