Skip to content

Instantly share code, notes, and snippets.

@mattseymour
mattseymour / build-instructions
Created May 1, 2017 06:58
Build Python 3.6 from source for Ubuntu and Debian
Prerequisties install:
- sudo apt-get install build-essential checkinstall
These are the dependancies required by python:
- sudo apt-get install libbz2-dev libc6-dev libgdbm-dev libncursesw5-dev libreadline-gplv2-dev libssl-dev libsqlite3-dev tk-dev
Download the tar source file from python.org (at the time of writing 3.6.1 is the latest release):
- wget -O ~/Downloads/python3.6.1.tgz https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
Via command line navigate to the downloaded file directory:
@dblalock
dblalock / align.c
Created August 30, 2017 22:11
C / C++ portable aligned memory allocation
/* Allocate aligned memory in a portable way.
*
* Memory allocated with aligned alloc *MUST* be freed using aligned_free.
*
* @param alignment The number of bytes to which memory must be aligned. This
* value *must* be <= 255.
* @param bytes The number of bytes to allocate.
* @param zero If true, the returned memory will be zeroed. If false, the
* contents of the returned memory are undefined.
* @returns A pointer to `size` bytes of memory, aligned to an `alignment`-byte
@ygrenzinger
ygrenzinger / CleanArchitecture.md
Last active April 28, 2025 15:23
Summary of Clean Architecture by Robert C. Martin

Summary of book "Clean Architecture" by Robert C. Martin

Uncle Bob, the well known author of Clean Code, is coming back to us with a new book called Clean Architecture which wants to take a larger view on how to create software.

Even if Clean Code is one of the major book around OOP and code design (mainly by presenting the SOLID principles), I was not totally impressed by the book.

Clean Architecture leaves me with the same feeling, even if it's pushing the development world to do better, has some good stories and present robust principles to build software.

The book is build around 34 chapters organised in chapters.

@iamwill123
iamwill123 / es6_reactive_ui.js
Last active October 5, 2022 22:23
Creating components w/ es6 vanilla javascript - Reactive UI
// This is my es6 re-write of the fiddle below.
// http://jsfiddle.net/cferdinandi/nb40j6rf/6/?mc_cid=1d481e891a&mc_eid=a3f6fd745a
// still a working progress but here is a live example:
// https://repl.it/@iamwill123/Creating-components-with-es6-vanilla-javascript-Reactive-UI
/**
* A vanilla JS helper for creating state-based components
* @param {String|Node} elem The element to make into a component
* @param {Object} options The component options
*/
@GuillaumeDua
GuillaumeDua / cpp_legacy_inheritance_vs_std_variant.md
Last active May 7, 2025 15:43
C++ legacy inheritance vs CRTP + std::variant
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active May 12, 2025 13:07
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@qinjian623
qinjian623 / onnx2pytorch.py
Last active September 26, 2024 13:55
ONNX file to Pytorch model
import onnx
import struct
import torch
import torch.nn as nn
import torchvision as tv
import warnings
# enum DataType {
# UNDEFINED = 0;
@raulqf
raulqf / Install_OpenCV4_CUDA12.6_CUDNN8.9.md
Last active May 19, 2025 05:31
How to install OpenCV 4.10 with CUDA 12 in Ubuntu 24.04

Install OpenCV 4.10 with CUDA 12.6 and CUDNN 8.9 in Ubuntu 24.04

First of all install update and upgrade your system:

    $ sudo apt update
    $ sudo apt upgrade

Then, install required libraries:

@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)

@luszczynski
luszczynski / keycloak_get_idp_token.md
Last active December 19, 2023 10:32
Keycloak - Get IDP Token using Curl

Keycloak - Get IDP Token

Get Access Token

export TKN=$(curl -X POST 'http://127.0.0.1:8080/auth/realms/your-realm/protocol/openid-connect/token' \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -d "username=your-user" \
 -d 'password=your-pass' \
 -d 'grant_type=password' \