Skip to content

Instantly share code, notes, and snippets.

public interface Accessor<T> {
public String getData();
}
public class ClassA {
private String superAwesomeData = "Woah.";
public String getSuperAwesomeData() { return this.data; }
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/legacy/legacy.hpp"
#include <iostream>
using namespace cv;
using namespace std;
@theJenix
theJenix / gist:6713887
Last active December 23, 2015 23:59
k-means clustering in LISP
; K-means Clustering
(defun diff-sq (x y)
(expt (- x y) 2))
(defun squared-differences (l1 l2)
(mapcar (lambda(x y) (float (expt (- x y) 2))) l1 l2))
(defun sum-squared-differences (l1 l2)
(reduce #'+ (squared-differences l1 l2)))

How to use a PS3 controller on Mac OS X 10.7 (Lion)

  1. Open Apple menu -> System Preferences -> Bluetooth and disable Bluetooth on Mac as well as any other nearby Macs or devices which will try to pair with and confuse the controller.

  2. Reset PS3 controller by inserting paperclip into pinhole near L2 button.

  3. Connect PS3 controller to Mac with USB cable.

  4. Enable Bluetooth.

[alias]
lol = log --graph --decorate --pretty=oneline --abbrev-commit
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
@theJenix
theJenix / gist:10338087
Created April 10, 2014 02:33
Arty Fischalinteligens stump speech
"it may be much worse than others."
"Again we are not better servants."
"on a keyboard mouse movements and physical bumps."
"to include the preceding decision node and yes at the Science Museum of London 53 370- 418."
"there must be substantial positive and it computes answers."
https://gist.github.com/b4866d7d6ede0b545753
int main(int argc, char **argv) {
short *shortp = 0;
int index = 1;
printf("%X\n", &shortp[index]);
printf("%X\n", &index[shortp]);
}
@theJenix
theJenix / test_ws.html
Created November 8, 2017 00:51
Test websockets client. Accepts query parameters to specify port and path
<!DOCTYPE html>
<html>
<head>
<title>WebSocket demo</title>
</head>
<body>
<script>
var url = new URL(window.location);
var c = url.searchParams.get("c");
var p = url.searchParams.get("p");
@theJenix
theJenix / mock.py
Created November 13, 2017 06:06
f360_mock.py
import sys
import inspect
import unittest
import unittest.mock
from . import patch
class EnhancedMock(unittest.mock.Mock):
""" An enhanced mock object that supports a wider array of mock patching than the base framework.