Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@peterdemin
peterdemin / diary
Created February 4, 2022 17:19
SH script to append text to a file and synchronize it using git
#!/bin/sh
DIARY_DIR=~/diary
DIARY_FILE=README.md
cd ${DIARY_DIR}
git pull -q
echo >> ${DIARY_FILE}
date >> ${DIARY_FILE}
echo >> ${DIARY_FILE}
@peterdemin
peterdemin / .bashrc
Created November 1, 2019 13:43
My bashrc file from NCBI
#!/usr/bin/env bash
# bash history
export HISTFILESIZE=99999
export HISTSIZE=99999
# solarized
export TMUX="screen-256color"
# vim
@peterdemin
peterdemin / django-tms.md
Last active September 13, 2018 18:09
Django-TMS

Django Text Management System

Motivation

Django templates often contain text/media that doesn't affect application's functionality. These texts belong to product people, but because they are stored in template files, are modified by developers. Such editing is slow and continious delivery pipelines treat it the same way as code changes.

How things used to be

@peterdemin
peterdemin / food.txt
Created July 19, 2018 00:31
List of food items
abiyuch
acerola
acorn
agave
agents
agutuk
alfalfa
amaranth
animal
apache
@peterdemin
peterdemin / update_deps.py
Created December 29, 2017 21:08
Build locked python requirements files for multiple environments
#!/usr/bin/env python
"""
Build locked requirements files for each of:
base.in
test.in
local.in
External dependencies are hard-pinned using ==
Internal dependencies are soft-pinned using ~=
".post23423" version postfixes are truncated
@peterdemin
peterdemin / commit-msg
Created December 29, 2017 13:44
Git commit-msg hook, that adds Jira ticket number from branch name to each commit message
#!/bin/sh
ticket=$(git symbolic-ref HEAD | grep -o 'ND-[0-9][0-9]*')
if [ -n "${ticket}" ]; then
grep -qs "^ *${ticket}" "${1}" || (echo >> "${1}" && echo "${ticket}" >> "${1}")
fi
@peterdemin
peterdemin / kibitzr.yml
Created May 27, 2017 21:42
Stash aggregation
transform:
- jinja: |
{%- set bofa = stash.bofa_credit | float -%}
{%- set discover = stash.discover | float -%}
{%- set amex = stash.amex | float -%}
{%- set checking = stash.bofa_checking | float -%}
{%- set savings = stash.bofa_savings | float -%}
{%- set credits = bofa + discover + amex -%}
{%- set total = -bofa - discover - amex + checking + savings -%}
```text
@peterdemin
peterdemin / kibitzr.yml
Created May 27, 2017 21:40
Banks aggregation
checks:
- name: bofa
url: https://www.bankofamerica.com/
form:
- id: onlineid1
creds: keyring.bofa.username
- id: passcode1
creds: keyring.bofa.password
- id: hp-sign-in-btn
@peterdemin
peterdemin / kibitzr.yml
Created May 9, 2017 15:43
TD Bank check
checks:
- name: TD
url: https://onlinebanking.tdbank.com/
form:
- id: txtUser
value: creds.td.username
- id: txtPassword
value: creds.td.password
transform:
- css: #balance
@peterdemin
peterdemin / kibitzr.yml
Created May 7, 2017 01:34
Discover check
checks:
- name: Discover
url: https://www.discover.com/
form:
- id: userid
creds: discover.login
- id: password
creds: discover.password
delay: 5
transform: