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 / Dockerfile
Created March 12, 2019 15:11
docker under corp proxy
FROM ubuntu:18.04
# MAINTAINER alex
# Give docker the rights to access X-server
# xhost +local:docker
# Run a terminal in container
# sudo docker run -it --rm -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix my-docker-gcc
# an example of how to build (with Makefile generated from cmake) inside the container
@blockspacer
blockspacer / CMakeLists.txt
Created March 12, 2019 16:00
cftf in docker
# 3.10 is the version I'm using, but if you're on a lower version feel free to comment out this line and report back results...
cmake_minimum_required(VERSION 3.10)
project(cftf)
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++abi")
find_package(Clang REQUIRED CONFIG HINTS /usr/bin /usr/lib64/cmake/clang)
find_package(LLVM REQUIRED CONFIG HINTS /usr/lib/llvm-6.0 /usr/lib64/cmake/llvm)
add_executable(cftf constexpr_if.cpp main.cpp rewriter.cpp structured_bindings.cpp template_specializer.cpp)
@blockspacer
blockspacer / README.md
Created March 20, 2019 14:13
qt-wasm-widgets-qml
@blockspacer
blockspacer / SingleFileOpenGLTex.cpp
Created March 26, 2019 07:58 — forked from mortennobel/SingleFileOpenGLTex.cpp
Single file OpenGL 3.3 / WebGL (using Emscripten) example with texture (SDL2 / SDL_Image 2)
//
// Compile for emscripten using
// emcc -Iinclude SingleFileOpenGLTex.cpp \
-O2 -std=c++14 -s TOTAL_MEMORY=33554432 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='["png"]' --preload-file examples/data -s USE_SDL=2 -o html/SingleFileOpenGLTex.html
// where the following images must be located in a subfolder
// - examples/data/test.png
// - examples/data/cartman.png
// - examples/data/cube-negx.png
// - examples/data/cube-negz.png
//
// g++ `pkg-config cairo-ft --cflags --libs` -lglut main.cpp
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#ifdef _MSC_VER
#include <windows.h>
#include <cairo.h>
#pragma comment(lib, "cairo.lib")
@blockspacer
blockspacer / main.c
Created April 12, 2019 05:55 — forked from mochja/main.c
Yoga + OpenGL Example
#include <GLFW/glfw3.h>
#include <yoga/Yoga.h>
#include <stdlib.h>
int main(void)
{
GLFWwindow* window;
/* Initialize the library */
if (!glfwInit())
@blockspacer
blockspacer / enum_bitmask.hpp
Created April 18, 2019 15:53 — forked from StrikerX3/enum_bitmask.hpp
Type-safe enum bitmasks
/*
Type-safe enum class bitmasks.
Based on work by Andre Haupt from his blog at
http://blog.bitwigglers.org/using-enum-classes-as-type-safe-bitmasks/
To enable enum classes to be used as bitmasks, use the ENABLE_BITMASK_OPERATORS
macro:
enum class MyBitmask {
None = 0b0000,
One = 0b0001,
Two = 0b0010,
@blockspacer
blockspacer / glfw_ship.cpp
Created April 29, 2019 09:33 — forked from PatWie/glfw_ship.cpp
instructions to use skia and glfw together. (download, installation, first program). works on Linux and Windows.
/* Note: this Google copyright notice only applies to the original file, which has large sections copy-pasted here. my changes are under CC0 (public domain).
* Copyright 2015 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/*
this is intended as a second-resort, after trying to build using the official instructions inevitably fails because of poor documentation and strange build systems.
@blockspacer
blockspacer / .htaccess
Created May 8, 2019 13:37 — forked from jgranick/.htaccess
SimpleGL
SetOutputFilter DEFLATE
@blockspacer
blockspacer / libpng_fix.md
Created May 22, 2019 08:54 — forked from bluenex/libpng_fix.md
fixing 'libpng warning: iCCP: known incorrect sRGB profile' appears in Pygame.

Libpng warning: iCCP: known incorrect sRGB profile.

Some .png images used in pygame may get the warning read as "libpng warning: iCCP: known incorrect sRGB profile". To solve this I have searched and found the solution by using ImageMagick. After installing, single file can be fixed by calling convert <in_img> -strip <out_img>, but to make it fixes every wanted images in path we'll need to modify just a little bit.

Create .bat file contains the following code and place this .bat in the folder that want to be fixed and run to finish it out.

@echo off
ping -n 2 127.0.0.1 > nul

echo this batch will convert ".png" using -strip option from ImageMagick.