Skip to content

Instantly share code, notes, and snippets.

🚍
' DROP TABLE user_statuses; --

Rich T. rtt

🚍
' DROP TABLE user_statuses; --
Block or report user

Report or block rtt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:8540519
g++ `pkg-config --cflags --libs opencv` ./libopencv_facerec.a -o out facerec.cpp -I ../include -lopencv_core -lopencv_highgui -lopencv_imgproc
View gist:7909784
> ~ dig @8.8.8.8 a spode.me
; <<>> DiG 9.8.5-P1 <<>> @8.8.8.8 a spode.me
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21871
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
View gist:7234236
unique_bind: function (els, e, lambda) {
// binds an event function to an element or set of elements
// but only if the event is not already registered on the element
$.LS.Log('onetime binding {0} els'.format(els.length));
$.each(els, function (ix, el) {
var x = $._data($(el).get(0), 'events');
if (typeof x === 'undefined' || x[e] === 'undefined') {
$(el).bind(e, function (event) {
lambda();
});
View gist:6610903
set: function (collection) {
// returns a set (as a list...) from a collection
// in other words, uniques
var o = {}, r = [], l = collection.length, i = 0;
for (; i < l; i++) {
if (!(collection[i] in o)) {
o[collection[i]] = true;
r.push(collection[i]);
}
}
View gist:6594003
#!/usr/bin/python
import sys
from collections import Counter
try:
with open(sys.argv[1], 'r') as f:
c = Counter(l.rstrip('\r\n') for l in f.readlines())
except IndexError:
print "Usage: ./count.py [infile]"
except IOError:
View gist:6593790
#!/usr/bin/python
import sys
from collections import Counter
try:
with open(sys.argv[1], 'r') as f:
c = Counter(l.rstrip('\r\n') for l in f.readlines())
except IndexError:
print "Usage: ./count.py [infile]"
except IOError:
View gist:6494086
> db.foo.aggregate([{$unwind: '$sub'}, {$match: {start: {$lte: 3}, end: {$gte: 6} }}])
{
"result" : [
{
"_id" : ObjectId("522da57d186b82d5279cb35c"),
"start" : 3,
"end" : 6,
"sub" : {
"start" : 3,
"end" : 6
View gist:6079283

Track day check list

  • Tape
  • Mirror caps
  • Spanner to undo mirrors
  • 14mm Spanner + screwdriver for suspension adjusting + owners handbook
  • Oil (500ml between the two of us?)
  • pressure gauge
@rtt
rtt / gist:5875621
Last active Dec 19, 2015
simple redis publisher
View gist:5875621
import redis
import threading
class Worker(threading.Thread):
'''Generic Main Worker class'''
def __init__(self, r, channels):
# init super
threading.Thread.__init__(self)
View gist:5344364
$.fn.slideTo = function(data) {
var width = parseInt($('#slider').css('width'));
var transfer = $('<div class="transfer"></div>').css({ 'width': (2 * width) + 'px' });
var current = $('<div class="current"></div>').css({ 'width': width + 'px', 'left': '0', 'float': 'left' }).html($('#slider').html());
var next = $('<div class="next"></div>').css({ 'width': width + 'px', 'left': width + 'px', 'float': 'left' }).html(data);
transfer.append(current).append(next);
$('#slider').html('').append(transfer);
transfer.animate({ 'margin-left': '-' + width + 'px' }, 300, function () {
$('#slider').html(data);
You can’t perform that action at this time.