Skip to content

Instantly share code, notes, and snippets.

Avatar

Manu Sánchez Manu343726

View GitHub Profile
@aeschright
aeschright / npm-strike.md
Last active Jul 27, 2019
A note about npm cli work status
View npm-strike.md

When will npm@6.9.1 be released (and other PRs merged?)

On March 22, npm fired several members of the open source and community team for discussing workplace conditions and other labor organizing activities. As a result, core employee contributors to the npm cli were removed from the project, and others have left in solidarity or put their work on hold.

Multiple claims were filed with the NLRB on this matter. The NLRB has investigated and found sufficient evidence of validity to proceed. The National Labor Relations Act of 1935 protects US employees' right to engage in discussions of workplace concerns without threat of retaliation -- and awareness of the importance of how we treat each other is something I valued so much in collaborating with the cli team. How can we work together if we aren't free to discuss what we need?

It's disappointing for all of us to find the work we were doing interrup

@shafik
shafik / WhatIsStrictAliasingAndWhyDoWeCare.md
Last active Jun 14, 2021
What is Strict Aliasing and Why do we Care?
View WhatIsStrictAliasingAndWhyDoWeCare.md

What is the Strict Aliasing Rule and Why do we care?

(OR Type Punning, Undefined Behavior and Alignment, Oh My!)

What is strict aliasing? First we will describe what is aliasing and then we can learn what being strict about it means.

In C and C++ aliasing has to do with what expression types we are allowed to access stored values through. In both C and C++ the standard specifies which expression types are allowed to alias which types. The compiler and optimizer are allowed to assume we follow the aliasing rules strictly, hence the term strict aliasing rule. If we attempt to access a value using a type not allowed it is classified as undefined behavior(UB). Once we have undefined behavior all bets are off, the results of our program are no longer reliable.

Unfortunately with strict aliasing violations, we will often obtain the results we expect, leaving the possibility the a future version of a compiler with a new optimization will break code we th

@dannguyen
dannguyen / sqlmd.sh
Last active Feb 26, 2021
A command-line function that runs a SQLite query and gets a Markdown-ready table; See console demo at https://asciinema.org/a/89573
View sqlmd.sh
### sqlmd
# Bash function for outputting SQLite results in Markdown-friendly table
### Dependency:
# csvlook can be found here: http://csvkit.readthedocs.io/en/540/scripts/csvlook.html
### USAGE
# $ sqlmd "SELECT name, age FROM people;" optional_db_name_argument.sqlite
### OUTPUT
View integral_variable.cpp
#include <utility>
#include <iostream>
#include <cstddef>
namespace atch { namespace {
template<class Tag>
struct meta_counter {
using size_type = std::size_t;
template<size_type N>
View jq-cheetsheet.md

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@dwilliamson
dwilliamson / Doc.md
Last active Apr 2, 2021
Minimal Code Generation for STL-like Containers
View Doc.md

This is my little Christmas-break experiment trying to (among other things) reduce the amount of generated code for containers.

THIS CODE WILL CONTAIN BUGS AND IS ONLY PRESENTED AS AN EXAMPLE.

The C++ STL is still an undesirable library for many reasons I have extolled in the past. But it's also a good library. Demons lie in this here debate and I have no interest in revisiting it right now.

The goals that I have achieved with this approach are:

View xxhash32_constexpr.cpp
// A C++11 constexpr implementation of xxhash32
// Jonathan Adamczewski / https://twitter.com/twoscomplement
// A reimplementation of code from https://github.com/Cyan4973/xxHash
// Foundation functions / commonly used patterns
// Read four chars and construct uint32_t (little endian)
constexpr uint32_t xxh_read32(const char* input)
{
@bishboria
bishboria / springer-free-maths-books.md
Last active Jun 13, 2021
Springer made a bunch of books available for free, these were the direct links
View gist:15e4f2e48f2a746ee256
// Myth #1: constexpr is the same as const
// (note: there is a difference between C++11 and C++14 here)
// (see: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3598.html)
namespace myth1 {
struct foo {
int i;
constexpr int& get() { return i; } // not a const function
}
int f() {