Skip to content

Instantly share code, notes, and snippets.

View e3krisztian's full-sized avatar

Krisztián Fekete e3krisztian

  • Budapest, Hungary
View GitHub Profile
@e3krisztian
e3krisztian / install-devpi.sh
Created November 20, 2013 14:55
Install devpi on a dedicated ubuntu [virtual]server
#!/bin/bash
# devpi install for a dedicated ubuntu server with upstart
# based on http://tim.freunds.net/blog/devpi.html
# execute as root (sudo)
set -ex # exit on error, print executed commands
DEVPI_VENV=/opt/devpi
DEVPI_USER=devpi
@e3krisztian
e3krisztian / sort-to-buckets.py
Created November 26, 2013 14:07
sort large amount of files into buckets by extracting the bucket name from file names with regexp, used to process ~500k files in a 4 directories
'''
sort-to-buckets '/dest/files-{}.lst' 'bucket-selector-python-regexp'
->
files:
/dest/files-1st-bucket.lst
...
/dest/files-last-bucket.lst
'''
import os
.. include:: <s5defs.txt>
.. |br| raw:: html
<br />
========================
Names for code fragments
========================
(based on reusability)
----------------------
@e3krisztian
e3krisztian / zip-residue.sh
Last active December 31, 2015 05:49
zip up files not yet added to git (they should be data files or other residue)
#!/bin/bash
# requires sponge from Debian(?) package moreutils
set -x
project=$(basename $(pwd))
date=$(date +%Y%m%d)
zipfile=${project}-${USER}-data-${date}.zip
@e3krisztian
e3krisztian / install-pypi.sh
Last active August 29, 2015 13:56
install pypi server on an ubuntu 12.04 LTS server
#!/bin/bash
PYPI_USER=pypi
PYPI_HOME=/home/$PYPI_USER
PYPI_VENV=/home/pypi/env
PYPI_REPO=/data/pypi/repo
PYPI_PASSWORD=/data/pypi/repo.htaccess
adduser pypi --disabled-password --gecos PYPI --home $PYPI_HOME
@e3krisztian
e3krisztian / sponge
Created February 14, 2014 10:36
reimplementation of moreutils' sponge
#!/bin/bash
# reimplementation of moreutil's sponge
# moreutil conflicts with GNU parallel on both Ubuntu and Fedora
# http://manned.org/sponge/c673547d
PATH=/bin:/usr/bin
outputfile="$1"
@e3krisztian
e3krisztian / start-test-pi
Created April 3, 2014 17:35
Start test pypiserver locally
#!/bin/bash
root=/ramdisk/pypiserver
package_dir=${root}/packages
mkdir -p ${package_dir}
htpasswd=${root}/htpasswd
htpasswd -bc ${htpasswd} testuser testpass
. ~/.virtualenvs/pypiserver/bin/activate
echo ============================
echo user-pass: testuser-testpass
echo ============================
#!/usr/bin/env python
# wagnerfischer.py: Dynamic programming Levensthein distance function
# Kyle Gorman <gormanky@ohsu.edu>
#
# Based on:
#
# Robert A. Wagner and Michael J. Fischer (1974). The string-to-string
# correction problem. Journal of the ACM 21(1):168-173.
#
# The thresholding function was inspired by BSD-licensed code from
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@e3krisztian
e3krisztian / install.sh
Last active August 29, 2015 14:18
PEX tools
# PEX
( VE="$(mktemp -d)"; virtualenv "$VE"; . "$VE/bin/activate"; pip install pex; pex -r pex -e pex.bin.pex:main -o ~/bin/pex; rm -rf "$VE"; )
# Python
pex -r autopep8 -e autopep8:main -o ~/bin/autopep8
pex -r pip-init -e pip_init:main -o ~/bin/pip-init
pex -r pyrene -e pyrene.main:main -o ~/bin/pyrene
# pex -r yolk -e yolk.cli:main -o ~/bin/yolk
pex -r ptpython -e ptpython.entry_points.run_ptpython:run -o ~/bin/ptpython
pex -r ptpython -r ipython -e ptpython.entry_points.run_ptipython:run -o ~/bin/ptipython