Skip to content

Instantly share code, notes, and snippets.

View pavoljuhas's full-sized avatar

Pavol Juhas pavoljuhas

  • Google
  • Venice, CA
View GitHub Profile
@pavoljuhas
pavoljuhas / rst.vim
Created December 10, 2013 16:45
Vim filetype plugin for restructured-text (rst) files. This file should be dropped to ~/.vim/ftplugin/ directory.
setlocal suffixesadd+=.rst
setlocal shiftwidth=3 shiftround
setlocal expandtab
setlocal textwidth=72
@pavoljuhas
pavoljuhas / pypath
Last active February 6, 2018 16:04
pywhichmodule, pypath -- find out what Python imports and where does it look
#!/usr/bin/env python
import sys
import os
mydir = os.path.realpath(os.path.dirname(sys.argv[0]))
notmydir = lambda d : not (os.path.exists(d) and
os.path.realpath(d) == mydir)
p = filter(notmydir, sys.path)
print('\n'.join(p))
@pavoljuhas
pavoljuhas / ctagswatch
Last active August 29, 2015 13:57
watch source files and re-run ctags whenever they change.
#!/bin/zsh -f
########################################################################
# setup:
setopt extendedglob
: ${WATCHPERIOD:=10}
: ${IDLETIMEOUT:=5400}
ignored=( '*?.o' '*?.obj' '*?.old' '*?.pro' '*?.*~' '*.bak' '*.pyc'
'*/#CVS/*' '*/#AAPDIR/*' )
ipat="(${(j:|:)ignored})"
@pavoljuhas
pavoljuhas / NaCl.cif
Last active December 4, 2015 17:01
Calculate PDF from a 2D slab with analytic baseline
#------------------------------------------------------------------------------
#$Date: 2010-01-30 13:59:17 +0000 (Sat, 30 Jan 2010) $
#$Revision: 966 $
#$URL: svn://cod.ibt.lt/cod/cif/1/1000041.cif $
#------------------------------------------------------------------------------
#
# This file is available in the Crystallography Open Database (COD),
# http://www.crystallography.net/
#
# All data on this site have been placed in the public domain by the
@pavoljuhas
pavoljuhas / sconscript.local
Last active April 5, 2016 19:18
sconscript.local for diffpy.srreal
# vim: ft=python
import sys
import os.path
Import('env')
env.CacheDir('/tmp/my-scons-cache')
includedir = sys.prefix + '/include'
libdir = sys.prefix + '/lib'
@pavoljuhas
pavoljuhas / screenshot.png
Last active September 7, 2017 17:46
example of wx.TextCtrl with a hyperlink
screenshot.png
@pavoljuhas
pavoljuhas / estimatepdfguiesds.py
Created November 1, 2017 16:02
fix estimate of standard deviations reported from PDFgui project
#!/usr/bin/env python
import sys
import numpy
def getfitesd(fit):
import cStringIO
from diffpy.pdffit2 import redirect_stdout
# throw away any output from pdffit2
redirect_stdout(cStringIO.StringIO())
#!/usr/bin/env python
##############################################################################
#
# diffpy.srreal by DANSE Diffraction group
# Simon J. L. Billinge
# (c) 2010 The Trustees of Columbia University
# in the City of New York. All rights reserved.
#
# File coded by: Pavol Juhas
#