Skip to content

Instantly share code, notes, and snippets.

for d in */ ; do cp sample.py $d`echo "$d" | sed 's/\(.*\)\..*/\1.py/'`; done
{
// Print debug message
"debug": false,
// Auto format on file save
"autoformat_on_save": false,
// The mapping key is `syntax name`, and the value is `formatting mode`.
// Note that the value for each mapping should be "c", "java" or "cs".
"user_defined_syntax_mode_mapping": {
@hb3p8
hb3p8 / getBufferSubData.cpp
Created April 19, 2017 11:21
getBufferSubData for Emscripten
int size = ...
void* data = new char[size];
EM_ASM_(
{
Module.ctx.getBufferSubData(Module.ctx.ARRAY_BUFFER, 0, HEAPU8.subarray($0, $0 + $1));
}, data, size);
@hb3p8
hb3p8 / text-textinput.cpp
Created December 22, 2016 08:13
Question regarding custom UnformatedText-like widget implementation #949
// Create text input in place of a text
static void TextAsWidgetReplacement(const ImRect& aabb, const char* label, ImGuiID id)
{
ImGuiContext& g = *GImGui;
ImGuiWindow* window = GetCurrentWindow();
// Our replacement widget will override the focus ID (registered previously to allow for a TAB focus to happen)
SetActiveID(g.ScalarAsInputTextId, window);
SetHoveredID(0);
FocusableItemUnregister(window);
{
"keys": ["ctrl+alt+w"],
"command": "reopen", "args": {"encoding": "Cyrillic (Windows 1251)" }
},
struct Noise3D
{
static const int size = 8;
sf::mesh::RealVector3 gradients[size][size][size];
float Drop(float dist)
{
float val = fabs (dist);
else if (aData.x < 0) // leaf node (containg triangles)
{
ivec4 aTrg0 = texelFetch (uGeometryTriangTexture, (aData.y + 0) + TRG_OFFSET (aSubTree));
ivec4 aTrg1 = texelFetch (uGeometryTriangTexture, (aData.y + 1) + TRG_OFFSET (aSubTree));
ivec4 aTrg2 = texelFetch (uGeometryTriangTexture, (aData.y + 2) + TRG_OFFSET (aSubTree));
ivec4 aTrg3 = texelFetch (uGeometryTriangTexture, (aData.y + 3) + TRG_OFFSET (aSubTree));
vec3 aTrg0Vrt0 = texelFetch (uGeometryVertexTexture, aTrg0.x += VRT_OFFSET (aSubTree)).xyz;
vec3 aTrg0Vrt1 = texelFetch (uGeometryVertexTexture, aTrg0.y += VRT_OFFSET (aSubTree)).xyz;
vec3 aTrg0Vrt2 = texelFetch (uGeometryVertexTexture, aTrg0.z += VRT_OFFSET (aSubTree)).xyz;
const size_t MAX_SIZE = 1<<24;
char* binary = new char[MAX_SIZE];
GLenum format;
GLint length;
theGlContext->core44->glGetProgramBinary (myRaytraceProgram->ProgramId(), MAX_SIZE, &length, &format, binary);
std::ofstream file ("D:/asm.bin", ios::out | ios::binary );
file.write (binary, length);
file.close();

Warning: the following will delete all your containers and all your images. Make sure that you backup any precious data!

Remember what we said above: Docker will create the data and metadata files if they don’t exist. So the solution is pretty simple: just create the files for Docker, before starting it!

  • Stop the Docker daemon, because we are going to reset the storage plugin, and if we remove files while it is running, Bad Things Will Happen©.
  • Wipe out /var/lib/docker. Warning: as mentioned above, this will delete all your containers all all your images.
  • Create the storage directory: mkdir -p /var/lib/docker/devicemapper/devicemapper.
  • Create your pool: dd if=/dev/zero of=/var/lib/docker/devicemapper/devicemapper/data bs=1G count=0 seek=250 will create a sparse file of 250G. If you specify bs=1G count=250 (without the seek option) then it will create a normal file (instead of a sparse file).
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2015, Nicolas P. Rougier. All Rights Reserved.
# Distributed under the (new) BSD License.
# -----------------------------------------------------------------------------
# This is a python implementation of the "Weighted Blended Order-Independent
# Transparency" technique by Morgan McGuire and Louis Bavoil
#
# This implementation use the glumpy python framework available from: