Skip to content

Instantly share code, notes, and snippets.

@digitalist
digitalist / LimitedSizeAllocator.h
Created March 16, 2016 19:03
limited_size_allocator
template<class T>
class LimitedSizeAllocator {
//http://stackoverflow.com/questions/1591591/can-one-leverage-stdbasic-string-to-implement-a-string-having-a-length-limitat
public:
typedef T value_type;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef T *pointer;
typedef const T *const_pointer;
@digitalist
digitalist / pre-commit
Created June 3, 2016 21:56
pre-commit git-hook to check for debug messages
#!/usr/bin/php
<?php
#for debug/scripting
#use --no-verify - like this:
#git commit -m "init" --no-verify
echo "============= RUNNING PRE-COMMIT HOOK\n\n";
$forbidden=array(
'var_dump',
'print_r',
'echo',
@digitalist
digitalist / docker-compose.yml
Created July 15, 2017 12:54
confluent:kafka/docker-compose
version: '3'
services:
zookeeper:
image: confluent/zookeeper
ports:
- 2181:2181
kafka:
#test: bin/kafka-topics --create --zookeeper zookeeper:2181 --replication-factor 1 --partitions 1 --topic test
image: confluent/kafka
@digitalist
digitalist / get_yaml_value.py
Created October 1, 2017 21:52
return yaml values by filename + yaml key/path
#!/usr/bin/env python
#pip install dpath
def get_yaml_config(path: str):
import yaml
with open(path, 'r') as ymlfile:
cfg = yaml.load(ymlfile)
return cfg
@digitalist
digitalist / generate_openssl_magic.sh
Last active November 8, 2017 15:24
OpenSSL CA/Client certs, keys
#!/usr/bin/env bash
#Field Meaning Example
#/C= Country GB
#/ST= State London
#/L= Location London
#/O= Organization Global Security
#/OU= Organizational Unit IT Department
#/CN= Common Name example.com
#CA
@digitalist
digitalist / soffice.convert2csv.sh
Created November 9, 2017 12:19
cheat-file for soffice spreadsheet (xls/ods) to csv conversion
#!/usr/bin/env bash
#soffice --headless --convert-to csv:"Text - txt - csv (StarCalc)":44,34,76,1,,true,false jira_csv/OrgPerson.ods
#params explained:
# https://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options#Filter_Options_for_the_CSV_Filter
#44, #1, the ASCII code for the separator
#34, #2, text quoting (34 is ", 44 is ' and so on..)
#76, #3, utf8
#1 #4,
#, #5, field delimiter default
#, #6, text delimiter default
@digitalist
digitalist / pocothread.cpp
Last active March 9, 2023 10:00 — forked from sumnjc/thread1.cpp
POCO Simple Thread example
// sample of using POCO's Thread
#include "Poco/Runnable.h"
#include "Poco/Thread.h"
#include <iostream>
using namespace std;
class Worker:public Poco::Runnable{
public:
@digitalist
digitalist / helloworld.cpp
Created February 10, 2018 22:19
helloworld for rapid testing
#include <iostream>
using namespace std;
int main()
{
cout << "Hello, World!";
return 0;
}
# $FreeBSD$
# openal-soft makefile for openal-soft patched (https://github.com/digitalist/openal-soft)
# fixes telegram-desktop, assaultcube and I think every openal-soft dependent packages
PORTNAME= openal-soft
PORTVERSION= 1.18.2
PORTREVISION= 1
CATEGORIES= audio
USE_GITHUB= yes
#http://xwmw.org/qastools/download.html
cd /usr/ports/devel/libudev-devd/ && sudo make install
sudo ln -s /usr/local/lib/libudev.so /lib/libudev.so
cd /tmp/
git clone git://git.code.sf.net/p/qastools/git
cd qastools-git
mkdir build
mkdir install