Skip to content

Instantly share code, notes, and snippets.

@vheon
vheon / README.md
Created March 30, 2022 12:07 — forked from gbraad/README.md
Git post-update hook

Git post-update hook

Checkout working copy and publish it. Put into .git/hooks and chmod +x post-update

For use with bare and non-bare repositories.

@vheon
vheon / ffs.c
Created November 20, 2017 14:00 — forked from jnthn/ffs.c
cross-platform first set bit
#include <stdio.h>
#include <stdlib.h>
#define MVMint32 int
#ifdef __GNUC__
#define FFS(x) __builtin_ffs(x)
#elif defined(_MSC_VER)
static __inline MVMint32 FFS(MVMint32 x) {
MVMint32 i = 0;
@vheon
vheon / asio_sendfile.cpp
Created September 13, 2017 13:24 — forked from mpapierski/asio_sendfile.cpp
boost.asio + sendfile(2)
// how to use boost.asio + sendfile(2)
// Michał Papierski <michal@papierski.net>
#include <iostream>
#include <string>
#include <boost/asio.hpp>
#include <boost/make_shared.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/ref.hpp>
#include <boost/bind.hpp>
#include <boost/enable_shared_from_this.hpp>
@vheon
vheon / build-arm-none-eabi-gdb.sh
Created November 3, 2015 22:18 — forked from ilg-ul/build-arm-none-eabi-gdb.sh
Build the ARM version of GDB on OS X.
#! /bin/bash
set -euo pipefail
IFS=$'\n\t'
GDB_VERSION="7.10"
GDB_BUILD_FOLDER="~/Work/gdb"
mkdir -p "${GDB_BUILD_FOLDER}"
cd "${GDB_BUILD_FOLDER}"
set cot=menu,menuone
ino <BS> <BS><C-r>=getline('.')[col('.')-3:col('.')-2]=~#'\k\k'?!pumvisible()?"\<lt>C-n>\<lt>C-p>":'':pumvisible()?"\<lt>C-y>":''<CR>
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : ""
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
function! s:skinny_insert(char)
if !pumvisible() && !exists('s:skinny_complete') &&
\ getline('.')[col('.') - 2].a:char =~# '\k\k'