Skip to content

Instantly share code, notes, and snippets.

((x * 0.25 [requirements] + 0.25 [design]) * 3 [revision time]) * (1 + (0.25 [security] + 0.5 [testing]))
@jksdua
jksdua / proj1.sql
Created April 11, 2015 15:57
comp3311 proj1
-- COMP9311 15s1 Project 1
--
-- MyMyUNSW Solution Template
-- Q1: ...
create or replace view Q1(unswid, name)
as
select people.unswid as unswid, people.name as name
from people, course_enrolments
where people.id = course_enrolments.student
@jksdua
jksdua / README.md
Created March 8, 2015 06:09
Hostgator shared hosting backup to AWS S3

Backup strategy

Hostgator shared hosting backup to AWS S3

Step 1

Install s3cmd command line tool.

  1. Copy s3cmd-setup.sh to the home folder via scp.
{
"auto_complete_commit_on_tab": true,
"bold_folder_labels": false,
"color_scheme": "Packages/User/SublimeLinter/Monokai (SL).tmTheme",
"file_exclude_patterns":
[
".DS_Store"
],
"font_size": 12.0,
"ignored_packages":
@jksdua
jksdua / feasible-technical-approaches.md
Created October 22, 2014 16:05
Feasible technical approaches

Text quality needs to be improved but hopefully it gives you an idea

Feasible approaches from a technical perspective

Custom development

Our company can act as a development partner assisting you with your development needs. Our technical and domain expertise puts us at an edge over other development companies. We work with you to come up with the besing design and develop the solution.

Cost

Cost of development + support contract

@jksdua
jksdua / decode.js
Created October 16, 2014 04:46
Decode url encoded SAML token
// Usage: decode.js "..."
// make sure to `npm install zlib` beforehand
// url -> base64 -> inflate
console.info('\n\nDecoded SAML:');
console.info('-------------\n');
console.info(
require('zlib').inflateRawSync(
new Buffer(
unescape(process.argv[process.argv.length - 1]),
@jksdua
jksdua / bug-reporting-template.html
Created January 21, 2014 13:59
Bug reporting HTML template - see comment for more details :)
<html>
<head>
<title>Report a Bug</title>
<style type="text/css">
/* apply a natural box layout model to all elements */
*, *:before, *:after {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
@jksdua
jksdua / xss.js
Created November 1, 2012 12:45
XSS prevention using JavaScript
// *** Prevent Javascript attacks using Javascript...sweet! ***
// Proof of concept for output encoding user input on the client side.
// Works in IE6+
// Some user input
var malicious_input = "<script>alert(document.cookie)</script>";
// Inserting it safely
var body = document.querySelector('body');
body.innerHTML = malicious_input.xssSafe();
@jksdua
jksdua / facebook decode signed_request.js
Created September 4, 2012 14:24 — forked from cyakimov/gist:1139981
Decode Facebook signed_request with NodeJS
//npm install b64url
//A signed_request for testing:
//WGvK-mUKB_Utg0l8gSPvf6smzacp46977pTtcRx0puE.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImV4cGlyZXMiOjEyOTI4MjEyMDAsImlzc3VlZF9hdCI6MTI5MjgxNDgyMCwib2F1dGhfdG9rZW4iOiIxNTI1NDk2ODQ3NzczMDJ8Mi5ZV2NxV2k2T0k0U0h4Y2JwTWJRaDdBX18uMzYwMC4xMjkyODIxMjAwLTcyMTU5OTQ3NnxQaDRmb2t6S1IyamozQWlxVldqNXp2cTBmeFEiLCJ1c2VyIjp7ImxvY2FsZSI6ImVuX0dCIiwiY291bnRyeSI6ImF1In0sInVzZXJfaWQiOiI3MjE1OTk0NzYifQ
var base64url = require('b64url');
var crypto = require('crypto');
var APP_SECRET = 'APP_SECRET';
function parse_signed_request(signed_request) {
@jksdua
jksdua / mongoose-schema-inheritance.js
Created July 31, 2012 00:36
Mongoose schema inheritance example
"use strict";
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
// ==== connect to database ====
mongoose.connect('mongodb://localhost/temp');