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> | |
int main(void) | |
{ | |
int i,j; | |
unsigned long long **m; | |
unsigned long long **mt; | |
while(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
Certificate: | |
Data: | |
Version: 1 (0x0) | |
Serial Number: | |
4b:52:49:a7:03:6d:87:ca:0a:ac:1c:0d:4e:8f:61:0d:f2:b1:d9:d7 | |
Signature Algorithm: sha256WithRSAEncryption | |
Issuer: CN = Easy-RSA CA | |
Validity | |
Not Before: Nov 9 13:36:51 2018 GMT | |
Not After : Dec 9 13:36:51 2018 GMT |
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
macro_rules! implement_index { | |
($t: ty, $size: expr) => { | |
impl ops::Index<usize> for BitVector<$t> { | |
type Output = u8; | |
fn index(&self, index: usize) -> Self::Output { | |
let block_index = index / $size; | |
let remainder = index % $size; |
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
// works: | |
assert_eq!(10, (0..10).map(|i| m.columns[i][i]).sum()); | |
let mut acc: i32 = 0; | |
// works | |
for i in 0..10 { | |
for j in 0..10 { | |
acc += m.columns[i][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
Welcome to microbenchmarking | |
Testing empty | |
Sorting... | |
Minimum num of cycles: 1 | |
Median num of cycles: 1 | |
Maximum num of cycles: 1 | |
Testing hundred_adds | |
Sorting... | |
Minimum num of cycles: 51 |
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 "bit.hpp" | |
#include "stdlib.h" | |
#include "mult.hpp" | |
void karatmult8(bit* r, const bit* f, const bit* g) { | |
const int n = 8, k = n/2; | |
// step 1 | |
// Load lower part | |
// noop in C, of course | |
// step 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
long long cycles, cycles2; | |
puts("Measuring..."); | |
for(int i = 0; i < N_TESTS; ++i) { | |
cycles = cpucycles(); | |
core(fenx, feny, x, 32); | |
cycles2 = cpucycles(); | |
tests[i] = cycles2 - cycles; | |
if (i == N_TESTS/2) { | |
puts("Halfway through"); | |
} |
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
@sensitive_variables() | |
@sensitive_post_parameters() | |
@require_POST | |
@csrf_exempt | |
def wiki_login(request): | |
apikey = request.POST.get('apikey') | |
user = request.POST.get('user') | |
password = request.POST.get('password') | |
if apikey != settings.WIKI_API_KEY: |
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
Measuring wastecycles(700000) | |
Sorting for waste = 700000 | |
Minimum num of cycles: 4230330 | |
Median num of cycles: 8232380 | |
Maximum num of cycles: 26124634 | |
Measuring wastecycles(750000) | |
Sorting for waste = 750000 | |
Minimum num of cycles: 4530074 | |
Median num of cycles: 8536382 |
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
/** | |
* Generate a random string in [a-z0-9] | |
* | |
* @param Length | |
* @return random alphanumeric string | |
*/ | |
public static function make_secret($Length = 32) { | |
$Str = ''; | |
while (strlen($Str) < $Length) { | |
$Hex = bin2hex(mcrypt_create_iv(10, MCRYPT_DEV_URANDOM)); |