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
""" | |
A TestRunner for use with the Python unit testing framework. It | |
generates a tabular report to show the result at a glance. | |
The simplest way to use this is to invoke its main method. E.g. | |
import unittest | |
import TestRunner | |
... define your tests ... |
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/local/bin/python3 | |
from multiprocessing import Process | |
from threading import Thread | |
import time | |
def f(n): | |
for i in range(n): | |
i | |
class Clock: |
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 OR REPLACE FUNCTION pivot( | |
refcursor, tablename character varying, | |
rowc character varying, | |
colc character varying, | |
cellc character varying, | |
celldatatype character varying) | |
RETURNS refcursor | |
LANGUAGE 'plpgsql' | |
COST 100 |
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 java.util.function.Function; | |
public class MyClass { | |
private static Function<Integer,Integer> outside(Integer y) { | |
return new Function<Integer, Integer>() { | |
@Override | |
public Integer apply(Integer x) { | |
return x + y; | |
} |
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 datetime import datetime | |
import logging | |
import os | |
import subprocess | |
logger = logging.getLogger(__name__) | |
class TcpDump: | |
def __enter__(self): | |
now = int(datetime.now().timestamp()) |
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 hyper::{self,Client}; | |
use hyper::rt::{self,Future,Stream}; | |
use hyper_tls::HttpsConnector; | |
use std::fs::File; | |
use std::io::prelude::*; | |
use futures::future; |
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(exercises). | |
-export([maximum/1,double/1,evens/1, median/1, modes/1]). | |
maximum([X|Xs]) -> maximum(Xs, X). | |
maximum([X|Xs], ACC) -> maximum(Xs, max(X, ACC)); | |
maximum([], ACC) -> ACC. | |
double([X|Xs]) when is_number(X) -> double(Xs, [2*X]). | |
double([X|Xs], ACC) when is_number(X) -> double(Xs, [2*X|ACC]); |
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(joining). | |
-export([join/2, concat/1]). | |
reverse([X|Xs]) -> reverse(Xs, [X]); | |
reverse([]) -> []. | |
reverse([X|Xs], ACC) -> reverse(Xs, [X | ACC]); | |
reverse([], ACC) -> ACC. | |
shunt([],Ys) -> | |
Ys; |
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(tail_recursion). | |
-export([is_perfect/1]). | |
is_perfect(N) -> | |
2*N == lists:sum(divisors(N)). | |
divisors(N) -> | |
divisors(N, 1, []). | |
divisors(N, I, ACC) when I*I < N andalso N rem I == 0 -> | |
divisors(N, I+1, [I|[N div I|ACC]]); |
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
The heat bloomed in December .VB | |
as the carnival season .CV | |
kicked into gear. .LP | |
Nearly helpless with sun and glare, I avoided Rio's brilliant .RP | |
sidewalks | |
and glittering beaches, | |
panting in dark corners | |
and waiting out the inverted southern summer. .JU |
OlderNewer