Skip to content

Instantly share code, notes, and snippets.

View g-pechorin's full-sized avatar
🏠
Working from home

Peter LaValle g-pechorin

🏠
Working from home
View GitHub Profile
@g-pechorin
g-pechorin / idea.properties
Last active December 16, 2015 21:19
portable IntelliJ & Maven
# copied from http://leolabs.org/blog/making-intellij-portable/
#---------------------------------------------------------------------
# Customize path to IDE config folder.
#---------------------------------------------------------------------
idea.config.path=${idea.home}/var/config
#---------------------------------------------------------------------
# Customize path to IDE system folder.
#---------------------------------------------------------------------
@g-pechorin
g-pechorin / gist:6150354
Last active December 20, 2015 14:58
Oh ... it does "print money"
sealed trait Function3D {
def apply(vec: Vector3): Float
override def toString = getClass.getSimpleName + ":" + parameterString
def encodeXML: Elem
/**
* Cheap trick to enforce toString
@g-pechorin
g-pechorin / CMakeLists.txt
Created January 3, 2014 20:12
A CMakeLists that'll download and extract some dependencies
cmake_minimum_required (VERSION 2.6)
project (XTRACT)
#
# libpng 1.6.8
if( NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/libpng-1.6.8 )
if( NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/libpng-1.6.8.tar.gz )
file(DOWNLOAD http://kent.dl.sourceforge.net/project/libpng/libpng16/1.6.8/libpng-1.6.8.tar.gz ${CMAKE_CURRENT_BINARY_DIR}/libpng-1.6.8.tar.gz SHOW_PROGRESS EXPECTED_MD5 29b7065906e2551508a0d7eacd19174e)
endif()
@g-pechorin
g-pechorin / Wrap Java Object - NotePad++ Regex
Created January 10, 2014 15:17
A pair of regular expressions / replacement strings that (I think) wrap one java class with another
find -> public (\w+) (\w+)\((.*?)\) \{\n\t\t\treturn .*?;
with -> public \1 \2\(\3\) \{\n\t\t\treturn inner.\2\(\3\);
find -> return inner.(\w+)\((\w+, )*.*? (\w+[,\)])
with -> return inner.\1\(\2\3
@g-pechorin
g-pechorin / GistDesktop.scala
Last active August 29, 2015 13:57
An example of libGDX and GLSL ES with correct(ish) maths
package com.peterlavalle.demo
import com.badlogic.gdx._
import com.badlogic.gdx.backends.lwjgl.LwjglApplication
import com.badlogic.gdx.graphics.glutils.ShaderProgram
import com.badlogic.gdx.math.{Vector3, Matrix4}
import com.badlogic.gdx.graphics.{PerspectiveCamera, GL20, VertexAttribute, Mesh}
import java.util
/**
@g-pechorin
g-pechorin / kitty_pointer.cpp
Last active August 29, 2015 14:02
fun with ram
/**
* Copyright and all glory to Peter LaValle / gPechorin
*
* This little joke is what C++ is good for ; memory acrobatics.
* This demonstrates (what I'm naming) a "kitty pointer"
* (I started it as shrimp_pointer but I decided no-one would care about mantis-shrimp)
* (someone else probably has a much more serious version of this somewhere)
*
* The thought process went;
* - I want to serialise wads of data
@g-pechorin
g-pechorin / ESPhysicObject.frag.glsl
Created July 18, 2014 21:04
Apologies for the machine-speek. I'm using NVidia's CGC compiler to do error checks, and she insists that there are errors related to array size
#ifdef GL_ES
precision highp float;
#endif
// varying
varying vec2 v_va_TextureCoordinates;
varying vec3 v_va_Normals;
// uniforms (not-textures)
@g-pechorin
g-pechorin / build.gradle
Created August 16, 2014 12:40
uses gradle to drive MarkDown
/*
This gradle file will produce a site in build/marksite from MarkDown files in src/site
markFolder - makes folders. is separate because or $reasons.
markSite - translates the .md files in src/site to HTML in build/site
markClean - deletes build/site
*/
String markDown = "src/site"
@g-pechorin
g-pechorin / tmp.cpp
Created September 5, 2014 14:28
WIP crc32 in TMP
/**
* We need string length - not "hard"
*/
template<const char text[]>
struct tmp_strlen
{
template<const char v, const int index>
struct tmp_strlen_
{
@g-pechorin
g-pechorin / sinlge.hpp
Last active August 29, 2015 14:07
TMP Vector and Square Matrix
/*
* Copyright 2014 Peter LaValle (with that name as my GMail) / g-pechorin
*
* Vector and square matrix header. Header for math functions that work on vectors and square matrices of arbitrary dimensions.
*
* You may use this under the Affero GNU GPL http://www.gnu.org/licenses/agpl-3.0.html
*
* Lacks rotation stuff since ... y'know those are specific to specific dimensions of matrix
* Other than std::string creation (which should only be used for debugging) - all methods are implemented as const templates (no loops or branches) so should optimize nicely
*