Skip to content

Instantly share code, notes, and snippets.

View blockspacer's full-sized avatar
:octocat:

Devspace blockspacer

:octocat:
  • Google
  • USA
View GitHub Profile
@blockspacer
blockspacer / builder.cpp
Created July 18, 2019 08:03 — forked from pazdera/builder.cpp
Example of `builder' design pattern in C++
/*
* Example of `builder' design pattern.
* Copyright (C) 2011 Radek Pazdera
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@blockspacer
blockspacer / reducing-build-times.md
Created August 6, 2019 08:32 — forked from niklas-ourmachinery/reducing-build-times.md
Reducing build times by 20 % with a one line change

Reducing build times by 20 % with a one line change

Experimenting a bit with the /d2cgsummary and /d1reportTime flags described by Aras here and here I noticed that one of our functions was consistently showing up in the Anomalistic Compile Times section:

1>	Anomalistic Compile Times: 2
1>		create_truth_types: 0.643 sec, 2565 instrs
1>		draw_nodes: 0.180 sec, 5348 instrs
@blockspacer
blockspacer / gd.md
Last active January 23, 2020 20:49
gd
@blockspacer
blockspacer / gist:577a177f76d5f99281c4aebcec4bd7db
Created August 21, 2019 10:36 — forked from LearnCocos2D/gist:77f0ced228292676689f
Overview of Entity Component System (ECS) variations with pseudo-code

For background and further references see: Entity Component Systems on Wikipedia

ECS by Scott Bilas (GDC 2002)

Entity->Components->Update
  • entity = class: no logic + no data OR at most small set of frequently used data (ie position)
  • component = class: logic + data
foreach entity in allEntities do
    foreach component in entity.components do
@blockspacer
blockspacer / cpp_dangers.md
Last active February 26, 2021 17:55
Dangers you can encounter when using C++.

About

Dangers you can encounter when using C++.

Calling virtual functions from a constructor or destructor is dangerous and should be avoided whenever possible.

Uninitialized data (Initialization in C++ is bonkers)

@blockspacer
blockspacer / Istio_cpp.md
Last active October 11, 2022 11:29
Istio C++

About Docker

About Kubernetes

  • pods are the base unit of operation for Kubernetes. Pods are the most visible, viable, and ephemeral units that comprise one or more tightly coupled containers. Kubernetes does not operate at the level of containers. There can be multiple pods in a single server node and data sharing easily happens in between pods. Kubernetes automatically provision and allocate pods for various services. Each pod has its own IP address and shares the localhost and volumes.
@blockspacer
blockspacer / borrow.cpp
Created August 30, 2019 05:44 — forked from foonathan/borrow.cpp
Quick'n'dirty implementation of Rust's borrow checker for a C++Now Lightning Talk - not supposed to be used
#include <iostream>
#include "borrow_checker.hpp"
int main()
{
auto i = 42;
// borrow `i` under name `ref`
borrow_var(ref, i)
/*
* g++ -lboost_system -lboost_iostreams -lboost_regex -lpthread -fPIC -g -shared -Wl,-soname,libnss_openvpn.so.2 -o /lib/libnss_openvpn.so.2 libnss_openvpn.cpp
*/
#include <string.h>
#include <nss.h>
#include <iostream>
#include <vector>
#include <map>
#include <boost/asio.hpp>
@blockspacer
blockspacer / tornado.yaml
Created September 10, 2019 08:43 — forked from ymesika/tornado.yaml
Websockets Demo (Istio v0.7.1 / Istio Nightly Build)
apiVersion: v1
kind: Service
metadata:
name: tornado
labels:
app: tornado
spec:
ports:
- port: 8888
name: http