pan using zoom behaviour, unfortunately not very smooth
This file contains hidden or 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
{-# LANGUAGE ForeignFunctionInterface #-} | |
module Adder where | |
import Foreign.C | |
adder :: CInt -> CInt -> IO CInt | |
adder x y = return $ x + y | |
foreign export ccall adder :: CInt -> CInt -> IO CInt |
This file contains hidden or 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 Control.Applicative ((<$>)) | |
center :: String -> Int -> String | |
center s n = spaces ++ s ++ spaces | |
where spaces = replicate ((n - length s) `div` 2) ' ' | |
-- http://www.haskell.org/haskellwiki/Blow_your_mind, Ctrl-F "pascal" | |
pascal :: [[Int]] | |
pascal = iterate (\row -> zipWith (+) ([0] ++ row) (row ++ [0])) [1] |
This file contains hidden or 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
<?php | |
/* | |
When using a current PHP version, class-phpmailer.php:validateAddress() uses a complex regex ("pcre8") for email address validation. | |
PHP < 7.3 uses libpcre 8.x. | |
PHP 7.3 uses libpcre2 10.x. | |
Due to a bug in libpcre2 < 10.32-RC1 https://bugs.exim.org/show_bug.cgi?id=2300, | |
this email regex validation fails in PHP 7.3 with PCRE_VERSION < 10.32. |
This file contains hidden or 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
#!python3 | |
import imaplib | |
import os | |
import asyncio | |
loop = asyncio.get_event_loop() | |
conf = [x.strip().split() for x in open('mbsyncrc')] |
This file contains hidden or 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
# let pred = | |
Array.init 100 (fun r -> | |
let a = n1 () in | |
let b = n1 () in | |
let c = a +. b in (* Makes the third column/predictor redundant and our data collinear! *) | |
[|a;b;c|]) ;; | |
val pred : float array array = | |
[|[|2.1000; 0.9001; 3.0001|]; [|1.7343; 2.9934; 4.7277|]; [|2.7644; 4.0290; 6.7935|]; | |
[|0.7972; 2.6754; 3.4726|]; [|0.6089; 2.7250; 3.3340|]; [|0.7870; 2.7721; 3.5592|]; | |
...|] |
This file contains hidden or 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 -f # no globbing, so we can safely use * | |
# other_local[joe]=:0, other_local[bob]=:1 etc. for all active local | |
# users other than us: | |
unset other_local; declare -A other_local; | |
while read -rd $'\t'; do | |
IFS=$',\n' r=($REPLY) | |
[[ "${#r[@]}" -ge 4 && "${r[4]}" != '*' && "${r[2]}" != '' && "${r[0]}" != '' ]] && other_local[${r[2]}]=${r[0]} |