Skip to content

Instantly share code, notes, and snippets.

View Twinklebear's full-sized avatar

Will Usher Twinklebear

View GitHub Profile
@Twinklebear
Twinklebear / android_java.txt
Last active August 29, 2015 13:57
Header troubles
Request Properties:
User-Agent: WhatAndroid Android,
Response Headers:
null: HTTP/1.1 200 OK,
Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0,
CF-RAY: 10edc7c8b0c30129-SJC,
Connection: keep-alive,
Content-Type: text/html; charset=utf-8,
Date: Fri, 21 Mar 2014 23:03:01 GMT,
@Twinklebear
Twinklebear / 3_spheres.txt
Created March 22, 2014 21:28
Basic OpenCL ASCII ray cast rendering
| |
| |
| . |
| .0. |
| . |
| ..0.. |
| .@@@. |
| 0@@@0 |
| .@@@. |
| ..0.. |
@Twinklebear
Twinklebear / gist:9820162
Created March 27, 2014 22:11
stack trace explosion
1526-1549/what.whatandroid W/System.err﹕ java.io.IOException: unexpected end of stream
03-27 18:09:34.693 1526-1549/what.whatandroid W/System.err﹕ at libcore.net.http.FixedLengthOutputStream.close(FixedLengthOutputStream.java:58)
03-27 18:09:34.693 1526-1549/what.whatandroid W/System.err﹕ at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:818)
03-27 18:09:34.693 1526-1549/what.whatandroid W/System.err﹕ at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:283)
03-27 18:09:34.703 1526-1549/what.whatandroid W/System.err﹕ at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:497)
03-27 18:09:34.703 1526-1549/what.whatandroid W/System.err﹕ at api.soup.MySoup.login(MySoup.java:154)
03-27 18:09:34.703 1526-1549/what.whatandroid W/System.err﹕ at what.whatandroid.login.LoginTask.doInBackground(LoginTask.java:46)
03-27 18:09:34.703 1526-1549/what.whatandroid W/System.err﹕ at what.whatandroid.login.LoginTask.doInBackground(LoginTask
@Twinklebear
Twinklebear / fragment.glsl
Last active August 29, 2015 14:00
Instanced textured quads, produces this render: https://i.imgur.com/opgHu0x.png
#version 330 core
//Sampler defaults to unit 0 which is where our texture is bound
uniform sampler2D tex;
in vec2 fuv;
out vec4 color;
void main(void){
@Twinklebear
Twinklebear / LoadingListener.java
Last active August 29, 2015 14:03
Minimal View Pager re-ordering crash
package will.testapp;
/**
* Fake listener to alert the adapter how many pages to be showing
*/
public interface LoadingListener {
public void loadingDone(int page, int pages);
}
@Twinklebear
Twinklebear / main.c
Last active August 29, 2015 14:04
Event handling snippet for Lorenzo_
#include <stdio.h>
#include <stdbool.h>
#include <SDL.h>
int main(int argc, char **argv){
if (SDL_Init(SDL_INIT_EVERYTHING) != 0){
fprintf(stderr, "SDL_Init Error: %s\n", SDL_GetError());
return 1;
}
@Twinklebear
Twinklebear / multi_iter.cpp
Created November 27, 2014 04:30
Simple silly multi iterator
#include <vector>
#include <algorithm>
#include <iostream>
template<class Iter>
class MultiIter {
std::vector<Iter> iters;
public:
using value_type = typename Iter::value_type;
@Twinklebear
Twinklebear / Cargo.lock
Last active August 29, 2015 14:13
Rust LTO related instruction bug with opening files
[root]
name = "bug_repr"
version = "0.0.1"
@Twinklebear
Twinklebear / IntrinsicsMips.td
Last active August 29, 2015 14:18
Issues hacking bits of AVX into MIPs for a hardware simulator
//===----------------------------------------------------------------------===//
//
// MipsTrax-specific intrinsics.
// This is at the end of the regular IntrinsicsMips.td file, these are the TRaX specific
// intrinsics
//===----------------------------------------------------------------------===//
def int_mips_atominc : Intrinsic<[llvm_i32_ty], [llvm_i32_ty]>;
def int_mips_invsqrt : Intrinsic<[llvm_float_ty], [llvm_float_ty], [IntrNoMem]>;
def int_mips_printfmstr : Intrinsic<[], [llvm_ptrptr_ty]>;
#include <string>
#include <iostream>
#include <vector>
class Bike{
public:
void Peddle(){
moving = true;
}
virtual void Move(){