Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#define COUNT 3
struct {int from; int to;} PINS[] = {
{1,5},
{2,4},
{14,72}
};
int main() {
FROM php:5.4-apache
# Install Python (needed for node.js)
RUN \
apt-get update && \
apt-get install -y python python-dev python-pip python-virtualenv && \
rm -rf /var/lib/apt/lists/*
# Install phpunit
RUN \
@MrTrick
MrTrick / gist:aabdbb9ae8afb1f108b2
Last active August 29, 2015 14:18
Travelling MrTrick Problem

I'd like to embark on a walking tour of Sydney's light rail stations.
I want to visit 10 stations then return back to the place I started.
I won't actually be catching any services! I just want to admire each station's amenities.

However, there's a certain set of rules I must follow:

  1. I will be starting and ending at the corner of Thomas St & Jones St; https://goo.gl/maps/jgar0
  2. A station can be visited any number of times, or never!
  3. After visiting an odd station (the 1st, 3rd, 5th, 7th, 9th), I can visit any station next. (even)
  4. After visiting an even station (the 2nd, 4th, 6th, 8th), the next (odd) station must be at least THREE stops away.
filters.source:
function(doc, req) {
if(!req.query.source)
throw("Please provide a query parameter `source`.");
if (doc.source && doc.source == req.query.source)
return true;
else
return false;
}
[Tue, 14 Sep 2010 05:44:03 GMT] [error] [<0.98.0>] {error_report,<0.30.0>,
{<0.98.0>,crash_report,
[[{pid,<0.98.0>},
{registered_name,[]},
{error_info,
{exit,
{{badmatch,{error,eacces}},
[{couch_file,init,1},
{gen_server,init_it,6},
{proc_lib,init_p_do_apply,3}]},
//Response produced when using no credentials,
//$ curl http://minion:5984/cgm/_fti/_design/couchapp/user
//
{"error":"unauthorized","reason":"You are not authorized to access this db."}
May your signals all trap
May your references be bounded
All memory aligned
Floats to ints rounded
Remember ...
Non-zero is true
++ adds one
Arrays start with zero
[root@limbo /]# chmod 777 /var/import/cass
[root@limbo /]# su hubprod -c "touch /var/import/cass/test.txt"
touch: cannot touch `/var/import/cass/test.txt': Permission denied
@MrTrick
MrTrick / gist:815611
Created February 8, 2011 00:44
Encryption / Decryption : Alice and Bob (and Eve!) [DRAFT]
Encryption / Decryption : Alice and Bob (and Eve!) [DRAFT]
Overview:
* Teams must devise a novel ciphering scheme in a short amount of time.
* Each team nominates a 'transmitter', who attempts to securely send a given message back to their team.
* Each team attempts to decode their own message, and intercept the messages of other teams.
Scenario:
Two types of documents (well four, but two in this use case)
Roles:
{
"_id": "role:00000390_student_11009_2010_AUT_U_1_S_group4",
"_rev": "1-82412c94266f8be1d4374313d586860d",
"doc_type": "role",
"source": "admin",
"status": "active",
"role_type": "student",