This file contains 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
#!/usr/bin/env python | |
import string | |
_rotors = [ 'EKMFLGDQVZNTOWYHXUSPAIBRCJ', | |
'AJDKSIRUXBLHWTMCQGZNPYFVOE', | |
'BDFHJLCPRTXVZNYEIWGAKMUSQO' | |
] | |
_reflector = "YRUHQSLDPXNGOKMIEBFZCWVJAT" | |
_key = "ABC" |
This file contains 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
gem 'angularjs-rails' | |
gem 'chart-js-rails' |
This file contains 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
const input = 'abc' | |
const inputLength = 3 | |
const powerSetSize = Math.pow(2, inputLength) | |
let result = [] | |
for (let k = 0; k < powerSetSize; k++) { | |
let set = ""; | |
let binaryDigits = k; | |
for (let j = 0; j < inputLength; j++) { |
This file contains 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
alias jira='open "http://jira-host.com/browse/$(git rev-parse --abbrev-ref HEAD)"' |
This file contains 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
#!/usr/bin/perl | |
$|=1; #disable output buffering, this is necessary for proper output through pipe | |
my @rotors = ('EKMFLGDQVZNTOWYHXUSPAIBRCJ','AJDKSIRUXBLHWTMCQGZNPYFVOE','BDFHJLCPRTXVZNYEIWGAKMUSQO'); | |
my $reflector = "YRUHQSLDPXNGOKMIEBFZCWVJAT"; | |
my $key = "ABC"; | |
sub li { |
This file contains 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
//UK format - commas for thousands separator, full stop for decimal. | |
//d = number of decimal points. | |
String.prototype.number_format = function(d) { | |
var n = this; | |
var c = isNaN(d = Math.abs(d)) ? 2 : d; | |
var s = n < 0 ? "-" : ""; | |
var i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0; | |
return s + (j ? i.substr(0, j) + ',' : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + ',') + (c ? '.' + Math.abs(n - i).toFixed(c).slice(2) : ""); | |
} |
This file contains 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
//Do something 2 seconds after view loads | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
[NSTimer scheduledTimerWithTimeInterval:2.0 | |
target:self | |
selector:@selector(theAction) | |
userInfo:nil |
This file contains 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
#include <iostream> | |
#include <cstring> | |
#include <array> | |
using namespace std; | |
const std::array<char, 27> alpha = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"}; | |
const std::array<std::array<char, 27>, 3> rotors | |
{ | |
{{"EKMFLGDQVZNTOWYHXUSPAIBRCJ"}, | |
{"AJDKSIRUXBLHWTMCQGZNPYFVOE"}, |
This file contains 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
#include <iostream> | |
#include <cstring> | |
using namespace std; | |
char alpha[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
char rotors[3][27] = | |
{ | |
"EKMFLGDQVZNTOWYHXUSPAIBRCJ", | |
"AJDKSIRUXBLHWTMCQGZNPYFVOE", | |
"BDFHJLCPRTXVZNYEIWGAKMUSQO" |
This file contains 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
/** | |
* Utility function to convert seconds to an iso8601 duration string. | |
* | |
* @param seconds int The number of seconds to encode. | |
* @return string iso8601 formatted duration | |
*/ | |
const iso8601Duration = (seconds = 0) => { | |
let _seconds = seconds; |