Skip to content

Instantly share code, notes, and snippets.

View bambocher's full-sized avatar

Dmitry Prazdnichnov bambocher

View GitHub Profile
@bambocher
bambocher / .git_hooks_pre-commit
Last active March 31, 2018 22:30 — forked from leucos/.git_hooks_pre-commit
Git pre-commit hook for Ansible Vault
#!/bin/bash
#
# Pre-commit hook that verifies if all files containing 'vault' in the name
# are encrypted.
# If not, commit will fail with an error message
#
# Original author: @ralovely
# https://www.reinteractive.net/posts/167-ansible-real-life-good-practices
#
# File should be .git/hooks/pre-commit and executable
@bambocher
bambocher / charset_convert.c
Last active December 25, 2015 20:19 — forked from jjgod/gb2u8.c
Пример использования библиотеки iconv. Компилируется в cygwin командой: gcc charset_convert.c -liconv -o charset_convert.exe
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <iconv.h>
char *charset_convert(const char *string, char *fromcode, char *tocode)
{
iconv_t cd;
size_t in, out, len, err;
char *dest, *outp, *inp = (char *) string;