Skip to content

Instantly share code, notes, and snippets.

View divanvisagie's full-sized avatar
🦕
It's a UNIX system, I know this!

Divan Visagie divanvisagie

🦕
It's a UNIX system, I know this!
View GitHub Profile
@divanvisagie
divanvisagie / shift_out.ino
Created March 25, 2013 19:00
Shift out multiple registers
#include <math.h>
int latch = 10,
clk = 11,
data = 12;
void setup(){
pinMode( latch , OUTPUT );

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@divanvisagie
divanvisagie / Output
Created April 3, 2013 20:06
Tests for serialport on node v0.10.x , the outputs are the same for both v0.8.21 and v0.10.2
data received: Th
data received: is i
data received: s so
data received: me s
data received: eria
data received: l da
data received: ta
data received: T
data received: his
@divanvisagie
divanvisagie / cluster.js
Created April 6, 2013 08:46
A constantly updated gist of a nice cluster pattern
var http = require( 'http' ),
cluster = require( 'cluster' ),
numCPUs = require( 'os' ).cpus().length;
if ( cluster.isMaster ){
for ( var i = 0 ; i < numCPUs; i++ ){
cluster.fork();
}
@divanvisagie
divanvisagie / bug.js
Created April 8, 2013 09:47
Add bugs to a site.
(function(){
var el = document.createElement( 'script' );
el.src = 'https://screen-bug.googlecode.com/git/screenbug-min.js';
document.body.appendChild( el );
})();
@divanvisagie
divanvisagie / ulimit.js
Created April 10, 2013 18:15
Set Limit
var posix = require( 'posix' );
posix.setrlimit('nofile', { soft: 10000 });
@divanvisagie
divanvisagie / angular_touch.html
Last active December 16, 2015 19:39
An example of how touch angular should be handled
<!DOCTYPE html>
<html ng-app="test">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js"></script>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://twitter.github.io/bootstrap/assets/css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="http://twitter.github.io/bootstrap/assets/css/bootstrap-responsive.css" rel="stylesheet" type="text/css" />
<script src="http://twitter.github.io/bootstrap/assets/js/bootstrap.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
/* HC-SR04 Sensor
https://www.dealextreme.com/p/hc-sr04-ultrasonic-sensor-distance-measuring-module-133696
This sketch reads a HC-SR04 ultrasonic rangefinder and returns the
distance to the closest object in range. To do this, it sends a pulse
to the sensor to initiate a reading, then listens for a pulse
to return. The length of the returning pulse is proportional to
the distance of the object from the sensor.
The circuit:
/*
Written by: Divan Visagie
Created On: 2013/06/09
This is my first attempt at actually doing something proper in Java
using nothing but a text editor and command line ,
I did it to make it snow (I was never a fan of java in the past but now I'm really open to new things)
*/
import java.io.IOException;
import java.io.OutputStream;