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
// Tests whether a string matches a file glob pattern, in | |
// which '*' matches any number of characters, '?' matches | |
// a single character, and anything else matches itself. | |
def matches: | |
->{ string pattern } | |
if (string pattern {isEmpty} on &&): true | |
else: | |
false | |
string peel ->{ ms ss } | |
option ms: ->s |
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 perl | |
# | |
# yubikey-scrabble.pl | |
# | |
# Finding the best Scrabble word that could appear in a YubiKey password. | |
# | |
# cpan List::UtilsBy | |
# chmod +x yubikey-scrabble.pl | |
# ./yubikey-scrabble.pl |
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 <array> | |
#include <cstdint> | |
#include <cstdlib> | |
#include <climits> | |
using namespace std; | |
uint32_t interleave(const uint16_t x, const uint16_t y) { | |
uint32_t result; | |
for (int i = 0; i < sizeof(uint16_t) * CHAR_BIT; ++i) | |
result |= (x & 1u << i) << i | (y & 1u << i) << (i + 1); |
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
def s{><replicate} | |
getLine{' 'neChar}span{readInt fromSome}toBoth->{w n} | |
w 0 if(n 2>){><}.. | |
{<>w>< -{'X's}{' 's}both if(n 2%0=){><}cat say}each |
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 <string> | |
#include <utility> | |
using namespace std; | |
template<class... Fs> struct Overload; | |
template<class F, class... Fs> | |
struct Overload<F, Fs...> : Overload<Fs...> { |
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
#define CAT(A, B) A##B | |
#define CAT_(A, B) CAT(A, B) | |
#define QUOTE(A) #A | |
#define QUOTE_(A) QUOTE(A) | |
#define PREFIX __ | |
#define SYMBOL(A) QUOTE_(CAT_(PREFIX, A)) | |
SYMBOL(hello) |
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/perl | |
# Originally written and placed in the public domain by Ashley Yakeley, 2003. | |
use warnings; | |
use strict; | |
use Pod::Usage; | |
use Getopt::Long; | |
my $help = 0; |
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
// “μσ” calculates the mean and standard deviation of a list, given the sum of the squares of the elements, the sum of the elements, and the reciprocal of the length. Uses real characters for more mathiness. | |
// With local variables, in infix: | |
def μσ (float float float → float float): | |
→ ss s in; | |
s ×. in → μ; | |
(ss ×. in −. μ sq) sqrt → σ; | |
μ σ | |
// With local variables, in postfix: |
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
(defun adaptive-wrap-fill-context-prefix (begin end) | |
"Like `fill-context-prefix', but with length adjusted by `adaptive-wrap-extra-indent'." | |
;; Note: fill-context-prefix may return nil; See: | |
;; http://article.gmane.org/gmane.emacs.devel/156285 | |
(let* ((fcp (or (fill-context-prefix begin end) "")) | |
(fcp-len (string-width fcp))) | |
(if (>= adaptive-wrap-extra-indent 0) | |
(concat (make-string fcp-len ?\ ) | |
"│" | |
(make-string adaptive-wrap-extra-indent ?\ )) |
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 <fcntl.h> | |
#include <signal.h> | |
#include <stdio.h> | |
#include <sys/mman.h> | |
#include <sys/time.h> | |
#include <unistd.h> | |
static char *buffer1; | |
static char *buffer2; | |
static const int page_size = 1 << 12; |
OlderNewer