Skip to content

Instantly share code, notes, and snippets.

@zertrin
zertrin / purge_logs.sh
Last active January 13, 2024 21:52 — forked from miohtama/purge_logs.sh
Remove old logs from Quassel SQLite database
#!/bin/bash
set -u
CURRENT_PATH="/var/lib/quassel/quassel-storage.sqlite"
BAK_PATH="/data/backup/quasselcore/quassel-storage.sqlite.bak"
DATE_TO_PRUNE='-180 day'
# This is an additional filter to only prune from a selected list of buffers,
@zertrin
zertrin / gcash2ledger.py
Last active January 12, 2021 16:43 — forked from nonducor/gcash2ledger.py
A simple script to convert an (uncompressed) gnucash XML file to the ledger-cli format
#!/usr/bin/env python3
import os
import sys
import dateutil.parser
import xml.etree.ElementTree
nss = {'gnc': 'http://www.gnucash.org/XML/gnc',
'act': 'http://www.gnucash.org/XML/act',
'book': 'http://www.gnucash.org/XML/book',
@zertrin
zertrin / conda_compare.py
Created July 25, 2019 09:32 — forked from ChrisBarker-NOAA/conda_compare.py
Python Script to compare two conda environments
#!/usr/bin/env python2
"""
quicky script that compares two conda environments
can be handy for debugging differences between two environments
This could be made much cleaner and more flexible -- but it does the job.
Please let me know if you extend or improve it.
@zertrin
zertrin / useful_pandas_snippets.py
Created September 25, 2016 17:17 — forked from bsweger/useful_pandas_snippets.md
Useful Pandas Snippets
# List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
# Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
# Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(valuelist)]
###
#
# Preseed for a Debian based machine on kvm
#
# Boot this file with: press TAB on the installer
# add the following to the boot parameters:
#
# install keymap=en_US locale=en_US netcfg/get_hostname=testserve \
# netcfg/get_domain=carfax.eu preseed/url=http://192.168.XXX.XXX:8000/wheezy.preseed
#
@zertrin
zertrin / python_resources.md
Created February 21, 2014 13:49 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

@zertrin
zertrin / 0_reuse_code.js
Created February 21, 2014 13:49
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@zertrin
zertrin / vimdiff.md
Last active December 17, 2015 18:28 — forked from mattratleph/vimdiff.md

vimdiff cheat sheet

##vimdiff commands

]c :        - next difference
[c :        - previous difference
do          - diff obtain
dp          - diff put
zo          - open folded text

zc - close folded text