Skip to content

Instantly share code, notes, and snippets.

View 2bbb's full-sized avatar

2bit 2bbb

View GitHub Profile
@2bbb
2bbb / MaxPS2.js
Created November 25, 2014 15:13
Dualshock Controller parser for Max
autocompile = true;
outlets = 3;
var NoteOutlet = 0,
CCOutlet = 1,
OSCOutlet = 2;
var ps2 = (function() {
var Controller = {
Buttons: {
@2bbb
2bbb / ofxFuckinMistake.h
Last active August 29, 2015 14:13
ofxFuckinMistake
#define flaot float
#define unsinged unsigned
#define cosnt const
#define Typename typename
#define tmpelate template
#define testApp ofApp
@2bbb
2bbb / Launch.scpt
Created February 26, 2015 09:10
Launch.scpt
var app = Application.currentApplication();
app.includeStandardAdditions = true;
JSON.parse(app.doShellScript("cat ~/launch.json")).map(Application).forEach(function(app){app.launch();app.activate();});
@2bbb
2bbb / image_mosaic_bookmarklet
Last active August 29, 2015 14:21
image mosaic bookmarklet
javascript:var%20d=document,f=function(e,i)%7Bfor(i=0;i%3C2;i++)e.setAttribute('style',%5B'','-webkit-'%5D%5Bi%5D+'filter:blur(6px)');%7D,p=d.getElementsByTagName('img'),i=0;for(;p&&i%3Cp.length;f(p%5Bi++%5D));
@2bbb
2bbb / youtube_mosaic_bookmarklet
Created May 26, 2015 10:20
youtube mosaic bookmarklet
javascript:var%20d=document,g='getElement',f=function(e,i)%7Bfor(i=0;i%3C2;i++)e.setAttribute('style',%5B'','-webkit-'%5D%5Bi%5D+'filter:blur(6px)');%7D,p,i;if(p=d%5Bg+'ById'%5D('player'))f(p);for(p=d%5Bg+'sByTagName'%5D('iframe'),i=0;p&&i%3Cp.length;i++)if(0%3C=p%5Bi%5D.src.search('youtube'))f(p%5Bi%5D);
@2bbb
2bbb / SimpleStopWatch.h
Last active August 29, 2015 14:22
SimpleStopWatch
namespace laziness {
struct SimpleStopWatch {
void start() {
_start = std::chrono::high_resolution_clock::now();
}
template <typename T = std::chrono::nanoseconds>
typename T::rep rap() {
_end = std::chrono::high_resolution_clock::now();
return std::chrono::duration_cast<T>(_end - _start).count();
@2bbb
2bbb / hex_print.h
Last active August 29, 2015 14:22
hex_print
#include <cstdio>
#include <cstdint>
template <typename T>
void hex_print(T v) {
switch(sizeof(T)) {
case 1: printf("0x%01X\n", *(reinterpret_cast<uint8_t *>(&v))); break;
case 2: printf("0x%02X\n", *(reinterpret_cast<uint16_t *>(&v))); break;
case 4: printf("0x%04X\n", *(reinterpret_cast<uint32_t *>(&v))); break;
case 8: printf("0x%08llX\n", *(reinterpret_cast<uint64_t *>(&v))); break;
@2bbb
2bbb / hex_print_again.cpp
Last active August 29, 2015 14:23
hex_print_again
#include <iostream>
union IntFloatUnion {
int i;
float f;
};
using namespace std;
int main(int argc, char *argv[]) {
IntFloatUnion u;
@2bbb
2bbb / hex_print.h
Last active August 29, 2015 14:23
new_hex_print
#include <iostream>
#include <iomanip>
template <typename T, size_t Size = sizeof(T)>
struct HexPrintable {
static void hex_print(T v) {
union {
T original;
uint8_t printing[Size];
} value;
@2bbb
2bbb / binary_data_study.cpp
Created June 18, 2015 10:29
binary_data_study
#include "ofMain.h"
class ofApp : public ofBaseApp {
struct hex_info {
bitset<32> bit_seq;
string str_form;
};
deque<hex_info> lines;
union {