Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import xml.etree.ElementTree as ET
def dump_one_entry(name, kind, path, fragment):
if fragment != '':
path = "%s#%s" % (path, fragment)
print ("INSERT INTO searchIndex (name, type, path) "
@xaizek
xaizek / first.cpp
Created December 27, 2017 10:18
Class method clash
#include "header.hpp"
#include <iostream>
class B : public A
{
void f()
{
doIt();
}
@xaizek
xaizek / find-missing-files.bash
Last active June 17, 2016 16:25
Compares the files in two directories to find ones which are present in the source but not in the destination and vice versa. Useful for data migrations.
#!/bin/bash
# Based on
# https://github.com/capncodewash/Misc-shell-scripts/blob/master/find_missing_files.sh
# by Graeme West which is in turn based on the answer kindly supplied by
# 'Unknown' at StackOverflow:
# http://stackoverflow.com/questions/3006014/finding-missing-files-by-checksum
# with additions from aleksejrs.
#
# Compares the files in two directories to find ones which are present in the
@xaizek
xaizek / list-picker.cpp
Last active May 3, 2019 11:49
ncurses++ usage example
// Copyright (C) 2016 xaizek <xaizek@openmailbox.org>
//
// This application is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This application is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@xaizek
xaizek / makewhatis.sh
Created January 5, 2016 15:56
stdman-makewhatis
#!/bin/sh
# Generated automatically from makewhatis.in by the
# configure script.
#
#!/bin/sh
# makewhatis: create the whatis database
# Created: Sun Jun 14 10:49:37 1992
# Revised: Sat Jan 8 14:12:37 1994 by faith@cs.unc.edu
# Revised: Sat Mar 23 17:56:18 1996 by micheal@actrix.gen.nz
# Copyright 1992, 1993, 1994 Rickard E. Faith (faith@cs.unc.edu)
@xaizek
xaizek / vim-limited-fold-width.diff
Last active November 20, 2015 09:08
Crude patch to limit width of a fold line in Vim.
diff --git a/src/screen.c b/src/screen.c
index d80ad6f..fbd2c41 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -2366,6 +2366,10 @@ compute_foldcolumn(wp, col)
if (fdc > wwidth - (col + wmw))
fdc = wwidth - (col + wmw);
+
+ if (fdc > 80)
#include <cstddef>
#include <iostream>
#include <new>
#include <utility>
template <typename T>
class Array
{
public:
#!/bin/bash
for arg; do
if [ ! -f "$arg" ]; then
echo "Usage: $(basename $0) [rc...]"
echo "Invoked without arguments uses ~/.bashrc"
exit 1
fi
done
function! ClangComplete(findstart, base)
if a:findstart
let l:line = getline('.')
let l:start = col('.') - 1
let b:clang_complete_type = 1
let l:wsstart = l:start
if l:line[l:wsstart - 1] =~ '\s'
while l:wsstart > 0 && l:line[l:wsstart - 1] =~ '\s'
let l:wsstart -= 1
endwhile