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
(module | |
(memory $memory 1) | |
(func $fib_recursive (export "fibonacci_rec") (param $N i64) (result i64) | |
(if | |
(i64.le_s (local.get $N) (i64.const 1)) | |
(then (return (local.get $N))) | |
) | |
(return | |
(i64.add |
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
import csv | |
import sys | |
# These tests are failing when gas costs are radically changed. | |
SKIPPED = [ | |
( | |
"casper_engine_tests::test::contract_api::get_call_stack::payment", | |
"payment_bytes_to_stored_session_to_stored_contract_", | |
), |
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
use num::traits::{Num, NumOps}; | |
use std::cmp::Ordering; | |
fn binary_search<T, F>(lower_bound: T, upper_bound: T, f: F) -> Result<T, T> | |
where | |
T: Copy + PartialOrd + Num + NumOps, | |
F: Fn(T) -> Ordering, | |
{ | |
let mut size = upper_bound; | |
let mut left = lower_bound; |
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
use num::traits::{Num, NumOps}; | |
use std::cmp::Ordering; | |
fn binary_search<T, F>(lower_bound: T, upper_bound: T, f: F) -> Result<T, T> | |
where | |
T: Copy + PartialOrd + Num + NumOps, | |
F: Fn(T) -> Ordering, | |
{ | |
let mut size = upper_bound; | |
let mut left = lower_bound; |
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
#!/bin/bash | |
set -e | |
DEV="/dev/dvd" | |
ISO_OUTPUT="/mnt/vault/Movies/DVD Backup/" | |
echo -n "Trying to read DVD label... " | |
DVD_NAME="$(blkid -o value -s LABEL $DEV)" |
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
#![no_std] | |
#![feature(alloc, cell_update, allocator_api)] | |
#[macro_use] | |
extern crate alloc; | |
extern crate core; | |
extern crate cl_std; | |
use cl_std::contract_api; |
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
FROM python:3.7.2 | |
# Build the code | |
WORKDIR /code | |
COPY . /code | |
# Compile source code into 'legacy' .pyc | |
RUN python -m compileall -b . && \ | |
find . -iname "*.py" -delete |
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 "json.hpp" | |
#include "autoprop.hpp" | |
using namespace mpapierski; | |
using json = nlohmann::json; | |
class Person : public AutoProp<Person> { | |
public: | |
AUTOPROP_BEGIN(Person); |
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
@contextmanager | |
def convert_to_pdf(filename): | |
"""Creates a PDF document based on input filename. | |
Returns a path to PDF file | |
""" | |
client = docker.from_env() | |
source = os.path.join('/tmp/{}'.format(os.path.basename(filename))) |
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 python3 | |
from collections.abc import Iterable | |
data = [1,2,[3,4,[5,6,[7,8,[9,10,[[[11],12],[13,14,15]]]]]]] | |
def flatten(data): | |
for value in data: | |
if isinstance(value, (Iterable,)): | |
# Call recursively to yield nested values from | |
yield from flatten(value) |
NewerOlder