This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Parse a string function definition and return a function object. Does not use eval. | |
* @param {string} str | |
* @return {function} | |
* | |
* Example: | |
* var f = function (x, y) { return x * y; }; | |
* var g = parseFunction(f.toString()); | |
* g(33, 3); //=> 99 | |
*/ | |
function parseFunction (str) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Convenience wrapper around VBoxManage for controlling VirtualBox virtual machines. | |
# | |
# Headless Ubuntu server gets stuck at boot menu on unsuccessful boots: | |
# http://serverfault.com/questions/243343/headless-ubuntu-server-machine-sometimes-stuck-at-grub-menu | |
function print_help { | |
echo "Usage: $(basename $0) [options] name" | |
echo "Easy control of VirtualBox virtual machines." | |
echo " -h Show this usage guide." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#dynamic port forwarding, binds a socket on the local machine | |
ssh -D 8080 user@host | |
#tunnel through proxy examples | |
chromium-browser --proxy-server="socks5://localhost:8080" | |
curl --socks5 localhost:8080 url | |
#most apps should recognize this | |
export HTTP_PROXY="socks5://localhost:8080" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;cl-opengl, load toon shader | |
(require :asdf) | |
(asdf:load-system :cl-opengl) | |
(asdf:load-system :cl-glu) | |
(asdf:load-system :cl-glut) | |
(defun file->string (path) | |
"Sucks up an entire file from PATH into a freshly-allocated string, | |
returning two values: the string and the number of bytes read." | |
(with-open-file (s path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "camshifting.h" | |
/* Create a camshift tracked object from a region in image. */ | |
TrackedObj* create_tracked_object (IplImage* image, CvRect* region) { | |
TrackedObj* obj; | |
//allocate memory for tracked object struct | |
if((obj = malloc(sizeof *obj)) != NULL) { | |
//create-image: size(w,h), bit depth, channels | |
obj->hsv = cvCreateImage(cvGetSize(image), 8, 3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;add to your .emacs | |
(defun git-commit-file-and-push (&optional commit-msg) | |
"Commit current file and push to git repository." | |
(interactive) | |
(if (null commit-msg) | |
(setq commit-msg (read-from-minibuffer "Commit message: "))) | |
(if (buffer-modified-p (current-buffer)) | |
(if (y-or-n-p "Save modified buffer? ") | |
(save-buffer))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Finish headless installation via `ssh pi@192.168.2.x` | |
# See /boot/config.txt | |
sudo apt-get update && sudo apt-get --purge dist-upgrade | |
sudo raspi-config | |
# Add locale en.us-utf8 (but keep en.gb-utf8) | |
sudo dpkg-reconfigure locales | |
# Timezone | |
sudo dpkg-reconfigure tzdata | |
# Update firmware |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- DuckDuckGo HTTPS search using Startpage suggestions. | |
- Url params: https://duckduckgo.com/params | |
- OSX location: Firefox.app/Contents/MacOS/browser/searchplugins | |
- In about:config, browser.search.defaultenginename = DuckDuckGo --> | |
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/"> | |
<ShortName>DuckDuckGo</ShortName> | |
<Description>DuckDuckGo Search</Description> | |
<InputEncoding>UTF-8</InputEncoding> | |
<Image width="16" height="16">https://duckduckgo.com/favicon.ico</Image> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;Animated Bouncing Square | |
;;; | |
(require :asdf) | |
(asdf:load-system :cl-opengl) | |
(asdf:load-system :cl-glut) | |
;;initial square position and size | |
(defparameter *x* 0.0) | |
(defparameter *y* 0.0) | |
(defparameter *rsize* 25) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/"> | |
<ShortName>Amazon.com</ShortName> | |
<Description>Amazon.com Search</Description> | |
<InputEncoding>ISO-8859-1</InputEncoding> | |
<Image width="16" height="16">data:image/x-icon;base64,AAABAAIAEBAAAAAAAAC0AQAAJgAAACAgAAAAAAAA6QIAANoBAACJUE5HDQoaCgAAAA1JSERSAAAAEAAAABAIBgAAAB/z/2EAAAF7SURBVDjLlZPLasJAFIaFRF+iVV+h6hO0GF+gVB9AaHwDt64qCG03tQgtdCFIuyhUelmGli66MXThSt24kNiFBUlAYi6ezjnNxSuawB/ITP7v/HNmJgQAEaZzpgHs/gwcTyTEXuXl2U6nA8ViEbK5HKler28CVRAwnB9ptVrAh8MrQuCaZ4iA8fzIqSgCxwzpTIaSuN/RWGwdYLwCUBQFZFkGSZLgqdmEE7YEN8VOAKyaSKUW4nNBAFmnYiKZpDRX1WqwBBzP089n5f/NEQsFL4WqqtsBWJlzDAJr5PwSMM1awEzzdxIbGI3Hvc6jCZeVFgRQRwpY7Qcw3ktgfpR8wLRxCPaot/X4GS95MppfF6DX9n2A3f+kAZycaT8bAZjU6r6B/duD6d3BYg9wQq/tkYzHY1blEiz5lmQyGc95mrO6r2CxgpjCBXgNsJVviolpXJiraeOIjJRE10juUa4sR8V+mO17VvmGqtuOcdNlwut8zTQJcJ0njifyB2bgTdKh6w4BAAAAAElFTkSuQmCCiVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACsElEQVRYw71XQWsTURBe2LQgeNKLB+tVemt6txcteNSD/QGC6VEIGDx5s+eKPQqFgJhLNdFLBWMP7cU0oSAWjB70koC9WHbVQ5SO8 |
NewerOlder