Skip to content

Instantly share code, notes, and snippets.

View billing.erl
database() ->
{1111, "Hula Hoops", 21},
{1112, "Hula Hoops (Giant)", 133},
{1234, "Dry Sherry, 1lt", 540},
{4719, "Fish Fingers" , 121},
{5643, "Nappies" , 1010},
View input.txt
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
and glittering beaches,
panting in dark corners
and waiting out the inverted southern summer. .JU
View tail_recursion.erl
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]]);
viniciusd / joining.erl
Created May 24, 2020
3rd section of the 2nd week of the Functional Programming in Erlang from the University of Kent
View joining.erl
-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) ->
View list_exercises.erl
-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]);
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;
from datetime import datetime
import logging
import os
import subprocess
logger = logging.getLogger(__name__)
class TcpDump:
def __enter__(self):
now = int(
import java.util.function.Function;
public class MyClass {
private static Function<Integer,Integer> outside(Integer y) {
return new Function<Integer, Integer>() {
public Integer apply(Integer x) {
return x + y;
View pivot.sql
refcursor, tablename character varying,
rowc character varying,
colc character varying,
cellc character varying,
celldatatype character varying)
RETURNS refcursor
LANGUAGE 'plpgsql'
COST 100
from multiprocessing import Process
from threading import Thread
import time
def f(n):
for i in range(n):
class Clock: