Skip to content

Instantly share code, notes, and snippets.

@mgsergio
mgsergio / gist:9916ae0f1e55695aec58792195bf68ad
Created August 28, 2023 15:11
FreeBSD 13 patch to make /etc/dhclient-script work on OVH
*** /sbin/dhclient-script Mon Jun 20 02:28:18 2022
--- /etc/dhclient-script Sun Jun 26 06:04:21 2022
***************
*** 174,179 ****
--- 174,193 ----
if [ "$new_ip_address" = "$router" ]; then
route add default -iface $router >/dev/null 2>&1
else
+ # OHV PATCH <<<
+ # OVH dhclient sends network settngs that make router unreachable from
@mgsergio
mgsergio / legend_tricks.py
Last active January 26, 2021 08:38
Matplotlib legend tricks
# Stolen from https://github.com/matplotlib/matplotlib/issues/12417
## 1
legend = plt.legend()
for legobj in legend.legendHandles:
legobj.set_sizes([64])
## 2
def update(handle, orig):
handle.update_from(orig)
👋🏻Intro
I’ve been in software development for 10 years and worked with different technologies
during that time (databases, languages, frameworks, clouds and tools). I’ve worked
in different roles from a programmer to a tech lead and solved problems of different
kinds and levels: from coding to communicating with stakeholders, designing system
architecture, specification decomposing, terms estimation and team management.
🔎What I’m looking for
Currently I’d like to consider the following options:
* Middle frontend developer (Typescript/Clojurescript/JavaScript, React, Vue)
I’m not
@mgsergio
mgsergio / enumerate.cpp
Last active December 22, 2015 12:09
A enumerate function to iterate over collection and have element's index with you. Like in python.
#include <utility>
#include <iterator>
namespace ext
{
namespace details
{
template <typename TCollection>
struct const_respective_iterator
{
@mgsergio
mgsergio / collection_cast.cpp
Created December 12, 2015 07:33
A nice way to construct one collection from another.
#include <type_traits>
namespace ext
{
namespace details
{
template <typename T>
struct value_type
{
using type = typename std::remove_reference<T>::type::value_type;
@mgsergio
mgsergio / range_iterator.cpp
Last active December 12, 2015 16:28
C++ range function and iterator inspired by python's range
#include <iterator>
#include <type_traits>
namespace ext
{
template <typename TCounter>
struct RangeIterator
{
explicit RangeIterator(TCounter const current):
m_current(current)
@mgsergio
mgsergio / HashTools.h
Created June 8, 2015 07:06
Calculate hash from many params of different type
#pragma once
#include <DB/Common/SipHash.h>
#include <Poco/SHA1Engine.h>
#include <Poco/MD5Engine.h>
#include <mysqlxx/DateTime.h>
#include <DB/Core/StringRef.h>
#include <utility>