Skip to content

Instantly share code, notes, and snippets.

@bad-ed
bad-ed / bash
Last active October 19, 2024 11:06
Bastille jail in XigmaNAS with ip address assigned by DHCP
# Inside jail we need to install mDNSResponder to properly answer DNS requests
pkg install mDNSResponder
# /usr/local/etc/mdnsresponder.conf
fancy
_http._tcp. local.
80
# /etc/rc.conf
mdnsresponderposix_enable="YES"
@bad-ed
bad-ed / gist:cbdb0b75bf6dcb790050397c936a5fab
Created March 11, 2019 07:56
Find string in files modified between 2 git commits (win32 cmd)
git diff --name-only <commit1> <commit2> | findstr /N /F:/ <string to lookup>
@bad-ed
bad-ed / template_traits.hpp
Created November 30, 2018 10:47
C++ traits for templates with type arguments (is_template, is_instance_of_template, is_derived_of_template)
#include <type_traits>
// Determine if `Instance` is instantiation of template
// e.g. static_assert(is_template<std::vector<int>>::value);
template<class Instance> struct is_template : std::false_type {};
template<class ...TemplateArgs, template<class...> class Template>
struct is_template<Template<TemplateArgs...>> : std::true_type {};
// Determine if `Instance` is instance of `Template`
// e.g. static_assert(is_instance_of_template<std::vector, std::vector<int>>::value);