Skip to content

Instantly share code, notes, and snippets.

// Example program
#include <array>
#include <cstdio>
int main()
{
std::array<int, 6> a {1, 1, 1, 2, 2, 2};
std::array<int, 10> b {};
for (auto v : b)
cmake_minimum_required( VERSION 3.8.0 )
project ( myproj )
add_subdirectory( ./core core )
add_library( mylib STATIC lib.cpp )
target_include_directories( )
// vertex shader
#version 310 es
#extension GL_EXT_shader_io_blocks : enable
#extension GL_ARB_enhanced_layouts : enable
precision highp float;
precision highp int;
layout( std140, binding = 0 ) uniform viewProjectionUniformBuffer
{
layout( offset = 0 ) mat4 u_viewMatrix;
layout( offset = 64 ) mat4 u_viewInverseMatrix;
@linuxaged
linuxaged / OpenWithSublimeText3.bat
Created June 26, 2017 10:46 — forked from roundand/OpenWithSublimeText3.bat
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 7)
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@linuxaged
linuxaged / odd_even.c
Created September 28, 2015 15:19
the number of digits of decimal integer is odd or even
#include <stdio.h>
#include <stdbool.h>
int main(int argc, char const *argv[])
{
int times = 0;
bool odd = false;
while(1){
int number;
template<int M, int K, int S>
struct Unit { // a unit in the MKS system
enum { m=M, kg=K, s=S };
};
template<typename Unit> // a magnitude with a unit
struct Value {
double val; // the magnitude
constexpr explicit Value(double d) : val(d) {} // construct a Value from a double
};
@linuxaged
linuxaged / HelloWorld.cs
Created June 8, 2015 07:44
il2cpp internals: method call
using UnityEngine;
using System;
public class HelloWorld : MonoBehaviour {
interface Interface {
int MethodOnInterface(string question);
}
private class Important: Interface {
public int Method(string question) { return 42; }
use std::thread;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering::SeqCst;
use std::rc::Rc;
use std::cell::RefCell;
struct Evil<'a> {
link: RefCell<Option<Rc<Rc<Evil<'a>>>>>,
arm: thread::JoinGuard<'a, ()>
}
android {
// .. set up build flavors etc here
//instead of "app-release.apk" this method will rewrite the name to
// "MyCoolCompany-MyGreatProduct-v<defaultConfig.versionName>-RELEASE.apk which is much better suited for archiving and overall handling
// To restore the default behavior just delete the whole block below
applicationVariants.all { variant ->
def apk = variant.outputFile;
@linuxaged
linuxaged / Badblue_fly.dae
Created November 25, 2014 08:57
Badblue_fly.dae
<?xml version="1.0" encoding="utf-8"?>
<COLLADA version="1.4.1" xmlns="http://www.collada.org/2005/11/COLLADASchema">
<asset>
<contributor>
<author>Jonas2</author>
<authoring_tool>3dsMax 11 - Feeling ColladaMax v3.05B.</authoring_tool>
<comments>ColladaMax Export Options: ExportNormals=1;ExportEPolyAsTriangles=1;ExportXRefs=1;ExportSelected=0;ExportTangents=0;ExportAnimations=1;SampleAnim=0;ExportAnimClip=0;BakeMatrices=1;ExportRelativePaths=1;AnimStart=0;AnimEnd=1.66667;</comments>
<source_data>file:///F:/Projects/Billions/max/BadBlueRig2.max</source_data>
</contributor>
<created>2010-02-26T15:43:05Z</created>