This file contains hidden or 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
| var str ="START LINE '$' END LINE", | |
| tmp = "\n\n\tSome stuff is here\n\n\t{{replace_me}}\n\n\t\nTHIS SHOULD BE AT THE END"; | |
| console.log(tmp.replace("{{replace_me}}", str)); |
This file contains hidden or 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
| def single_character_xor(string, xor): | |
| xored = map(lambda n: n ^ ord(xor), map(ord, string)) | |
| return "".join(map(chr,xored)) | |
| def detect_wtf(string): | |
| for i in range(255): | |
| xored = single_character_xor(string, chr(i)) | |
| if xored[0] == string[0].upper(): | |
| print string+" when XORed with %d"%i+"="+xored |
This file contains hidden or 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
| def hamming_distance(a,b): | |
| """ | |
| Computes the byte difference between two strings. | |
| >>> hamming_distance("this is a test", "wokka wokka!!!") | |
| 37 | |
| """ | |
| count = 0 | |
| a = string_to_byte_array(a) | |
| b = string_to_byte_array(b) |
This file contains hidden or 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
| function DatabaseClient(callback) { | |
| var self = this; | |
| var queue = []; | |
| var ready = false; | |
| console.log("Connecting to database."); | |
| function run(method, args) { | |
| console.log("Executing operation: Database."+method); |
This file contains hidden or 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
| function concat() { | |
| var output = ""; | |
| Array.prototype.forEach.call(arguments, function(arg) { | |
| output += arg; | |
| }); | |
| return output; | |
| } | |
| console.log(concat('abc', 'def', 'ghi')); // 'abcdefghi' |
This file contains hidden or 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
| function createUser(username, callback) { | |
| var connection = DatabaseClient.connect(); | |
| var users = connection.call('collection', 'users'); | |
| var query = users.call('query', {username: username}); | |
| return query.then(function(existing){ | |
| if(existing) throw new Error("User already exists: " + username); | |
| else return users.call('create', {username: username}); | |
| }).fin(function(connection){ return connection.call('close'); }); | |
| } |
This file contains hidden or 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
| function createUser(username, callback) { | |
| var connection = DatabaseClient.connect(); | |
| var users = connection.collection('users'); | |
| var query = users.query({username: username}); | |
| return query.then(function(existing){ | |
| if(existing) throw new Error("User already exists: " + username); | |
| else return users.create({username: username}); | |
| }).fin(function(connection){ return connection.call('close'); }); | |
| } |
This file contains hidden or 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
| from blessings import Terminal | |
| from time import sleep | |
| from random import randrange, choice | |
| class Glyph(): | |
| def __init__(self, content, terminal): | |
| self.content = content | |
| self.terminal = terminal |
This file contains hidden or 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
| function GRUNDTAL(taskType, data) { | |
| var template = document.getElementById(taskType + 'Task-template').innerHTML; | |
| this.template = Handlebars.compile(template); | |
| this.taskName = taskType; | |
| this._data = data || {}; | |
| this.step = this._data.step || 'info'; | |
| } | |
| GRUNDTAL.prototype = { |
This file contains hidden or 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
| from labsuite.protocol import Protocol | |
| from labsuite.protocol.formatters import JSONFormatter | |
| protocol = Protocol() | |
| protocol.set_info( | |
| name="Test Protocol", | |
| description="A protocol to test JSON output.", | |
| author="Michelle Steigerwalt" | |
| ) |