Skip to content

Instantly share code, notes, and snippets.

View jirikuncar's full-sized avatar
💭
👨‍💻

Jiri Kuncar jirikuncar

💭
👨‍💻
View GitHub Profile
@jirikuncar
jirikuncar / osx-setup.sh
Created June 23, 2016 13:57 — forked from somebox/osx-setup.sh
Set up an OSX machine from zero to awesome. Uses Homebrew (and cask, fonts, etc). Focused on Ruby/Rails development, includes rvm, xquartz, editor fonts, sublime text, and many tools.
#!/bin/bash
# A script to set up a new mac. Uses bash, homebrew, etc.
# Focused for ruby/rails development. Includes many utilities and apps:
# - homebrew, rvm, node
# - quicklook plugins, terminal fonts
# - browsers: chrome, firefox
# - dev: iterm2, sublime text, postgres, chrome devtools, etc.
# - team: slack, dropbox, google drive, skype, etc
@jirikuncar
jirikuncar / keybase.md
Last active April 18, 2016 12:32
keybase.md

Keybase proof

I hereby claim:

  • I am jirikuncar on github.
  • I am jirikuncar (https://keybase.io/jirikuncar) on keybase.
  • I have a public key ASAO85pR4iDSbCVYfJXmhMiPC9CeUBlqj8OzSOiT3uAcxQo

To claim this, I am signing this object:

@jirikuncar
jirikuncar / sqlalchemy.ipynb
Created October 7, 2015 19:23
SQLAlchemy Demo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jirikuncar
jirikuncar / gist:654560a5e4f5498ffa4f
Last active January 15, 2020 10:26
Module separation
git clone https://github.com/inveniosoftware/invenio-$PACKAGE
cd invenio-$PACKAGE/
git remote add invenio https://github.com/inveniosoftware/invenio
git fetch invenio
git checkout -b master invenio/master
git log --follow invenio/modules/$PACKAGE/models.py
git log --stat --follow invenio/modules/$PACKAGE/models.py
git checkout -b rename fe01274ee7afa8025ae5bfea88eb231dd299637a
git checkout -b pre-rename rename~
git filter-branch -f --subdirectory-filter modules/$LEGACY/
@jirikuncar
jirikuncar / git-update-year
Last active August 29, 2015 14:17
git: update year
COMMIT=$1
YEAR=`date +"%Y"`
START=${YEAR:0:3}
END=${YEAR:3:4}
CMD="sed -i '' 's/\($START[^$END]\) CERN\.$/\1, $YEAR CERN./'"
echo $CMD `git diff-tree --no-commit-id --name-only -r $COMMIT` | sh
@jirikuncar
jirikuncar / git-user-yearly-stats
Created March 19, 2015 10:09
git: user yearly stats
git log --author="`git config --get user.name`" --pretty=tformat: --numstat --since=`date --date='1 year ago' +"%Y-%m-%d"` | awk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } END { printf "added lines: %s removed lines: %s total lines: %s\n",add,subs,loc }’ -
@jirikuncar
jirikuncar / csv2marcauthority.py
Created June 27, 2014 11:31
Export Frontiers csv to marc
import csv
import sys
import itertools
header = """<?xml version="1.0" encoding="UTF-8"?>
<collection xmlns="http://www.loc.gov/MARC21/slim">"""
footer = """</collection>"""
if __name__ == '__main__':
records = []
@jirikuncar
jirikuncar / webdoc2rst.py
Last active August 29, 2015 14:02
Invenio WebDoc to rst migration script
import subprocess
from invenio.base.factory import with_app_context
def html2rst(html):
p = subprocess.Popen(['pandoc', '--from=html', '--to=rst'],
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
return p.communicate(html)[0]
@with_app_context()
def main():
@jirikuncar
jirikuncar / check-py-files.sh
Created June 8, 2014 18:11
Check header in python files
find invenio -iname \*.py -exec grep -H -E -o -c "^# -\*- coding: utf-8 -\*-$" {} \; | grep py:0 | cut -d: -f1