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
function Get-PublicKey | |
{ | |
[OutputType([byte[]])] | |
PARAM ( | |
[Uri]$Uri | |
) | |
if (-Not ($uri.Scheme -eq "https")) | |
{ | |
Write-Error "You can only get keys for https addresses" |
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
alert('hi mom =]'); |
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
git-delete-func() { | |
# do basic pattern matching to prevent command injection (or mistakes)... | |
# note: this pattern is just a character-set based on my standard branches - it could be better =P | |
pattern="a-zA-Z0-9/._-" | |
if [[ $1 =~ [^$pattern] ]]; then | |
echo -e "invalid branch pattern\n"; | |
return 1; | |
fi; | |
# verify the branch exists |
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
// create a new thread pool service with 6 threads | |
ScheduledExecutorService service = Executors.newScheduledThreadPool(6); | |
// iterate over your list of trains | |
for (Train train : trainList) { | |
// determine how long of a delay between the current station and the next | |
int delay = ...; | |
// schedule the future service | |
ScheduledFuture future = service.schedule(new DispatchTask(train), delay, TimeUnit.SECONDS); |
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 <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <math.h> | |
int main() { | |
int string_len = 4; | |
char alphabet[] = "abc"; | |
int alphabet_len = ((sizeof(alphabet) / sizeof(alphabet[0])) - 1); | |
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
<?php | |
$string_len = 5; | |
$alphabet = 'abc'; | |
$alphabet_len = strlen($alphabet); | |
for ($s = 1; $s <= $string_len; $s++) { | |
$current_key = str_repeat($alphabet[0], $s); |
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
// event used to submit the form | |
var keydownEvent = $.Event('keydown', { which: 13 }); | |
// input field that takes user-instructions | |
var $entry = $('#textentry'); | |
// text blocks that we're interested in | |
var executingBytes = document.getElementById('insnbytes'); | |
var decodedBytes = document.getElementById('insndecoded'); |
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
function getMoarCoins() { | |
var randDelay = Math.floor((Math.random() * 10) + 1) * 1000; | |
$.get('/unicoin/rock').done(function (e) { | |
setTimeout(function() { | |
var rockId = e.rock; | |
$.post('/unicoin/mine?rock=' + rockId, {fkey: StackExchange.options.user.fkey}).done(function (t) { | |
if (t.result !== 'Success') { | |
console.log('Failed to mine rock ' + rockId); | |
} else { | |
console.log('Mined rock ' + rockId + ' for ' + t.value + ' coins with a ' + (randDelay / 1000) + ' second delay!'); |