- By Edmond Lau
- Highly Recommended 👍
- http://www.theeffectiveengineer.com/
- They are the people who get things done. Effective Engineers produce results.
Require Import Coq.Sets.Ensembles. | |
Require Import Coq.Sets.Powerset_facts. | |
Require Import Coq.Setoids.Setoid. | |
Section SetExample. | |
Variable U: Type. | |
Definition USet := Ensemble U. | |
Notation "X ∩ Y" := (Intersection U X Y) (at level 41). |
#!/usr/bin/env python3 | |
"""GoDaddy DNS API using credentials stored in a GPG-encrypted file. | |
The gpg-encrypted file (`dns.env.gpg` by default) must contain at least two | |
required variables: | |
GODADDY_PROD_KEY="..." | |
GODADDY_PROD_SECRET="..." |
-module(loop). | |
-export([for/2, for/4, while/2, repeat/2]). | |
%%% Let's make Erlang great again! | |
% Look, today we are going to fix the glaring omission, | |
% I promise you that. | |
% We are going to build a loop module for Erlang! | |
% A loop module for Erlang, yes! |
(use-modules | |
(ice-9 hash-table) | |
(srfi srfi-1)) | |
(define (for-each-file-line filepath thunk) | |
(with-input-from-file filepath (lambda () | |
(let loop ((line (read-line))) | |
(if line | |
(begin | |
(thunk line) |
#!/bin/bash | |
PLAYER=mplayer | |
PLAYER_OPTIONS=-prefer-ipv4 | |
while getopts "gch" opt; do | |
case $opt in | |
g) PLAYER=smplayer | |
export DISPLAY=:0 | |
;; |
I hereby claim:
To claim this, I am signing this object:
class BinHeap: | |
def __init__(self): | |
self.h = [] | |
def __len__(self): | |
return len(self.h) | |
def _parent_index(self, i): | |
return (i - 1) / 2 |
-module(deembed). | |
-export([main/1]). | |
read_bins(Data, 0) -> Data; | |
read_bins(<<NameSize, Name:NameSize/binary, | |
DataSize:32, _BinData:DataSize/binary, | |
Rest/binary>>, N) when N > 0 -> | |
io:format(" ~p (~p bytes)\n", [binary_to_list(Name), DataSize]), | |
read_bins(Rest, N - 1). |
-- GHC 7.8.3, Core i5 1.3 GHz | |
{-# LANGUAGE BangPatterns #-} | |
import Data.List | |
{- naive sum over length -} | |
average0 xs = sum xs / fromIntegral (length xs) | |
-- ghc -O0 : real 6.392s, sys 0.758s | |
-- ghc -O3 : real 2.198s, sys 0.323s | |
-- ghci: 7.54s, 2_574_335_872 b |