Skip to content

Instantly share code, notes, and snippets.

View tene's full-sized avatar

Stephen Weeks tene

  • Sunnyvale, CA
View GitHub Profile
use futures::future::join_all;
use std::{collections::HashMap, error::Error};
use tracing::{debug, field::Visit, info};
use tracing_attributes::instrument;
use tracing_core::Subscriber;
use tracing_subscriber::{
layer::Context, layer::SubscriberExt, registry::LookupSpan, Layer, Registry,
};
#[derive(Clone, Debug)]
[tene@vrici ~]$ ghci
GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help
Prelude> :t foldl
foldl :: Foldable t => (b -> a -> b) -> b -> t a -> b
Prelude> let x = [(+2),(+3),(+4)]
Prelude> :t x
x :: Num a => [a -> a]
Prelude> :t ($)
($) :: (a -> b) -> a -> b
Prelude> :t flip ($)
extern crate sparkline;
use sparkline::*;
use std::io::BufReader;
use std::io::BufRead;
use std::io::Write;
use std::net;
use std::env;
use std::error::Error;
use std::collections::HashMap;
@tene
tene / AssetDB.hs
Last active August 29, 2015 14:20
module AssetDB where
import Text.ParserCombinators.Parsec
import Data.List (intercalate)
data Query = Class String
| Role String
| Attr String (Maybe String)
| Tag String
| Status String
| Host String
@tene
tene / bt1
Last active August 29, 2015 14:03
(gdb) bt
#0 mozalloc_abort (msg=msg@entry=0x7fffffffbd96 "out of memory: 0x", '0' <repeats 14 times>, "10 bytes requested") at /build/buildd/firefox-30.0+build1/memory/mozalloc/mozalloc_abort.cpp:30
#1 0x00007ffff559149a in mozalloc_handle_oom (size=0, size@entry=16) at /build/buildd/firefox-30.0+build1/memory/mozalloc/mozalloc_oom.cpp:50
#2 0x00007ffff5591284 in moz_xmalloc (size=16) at /build/buildd/firefox-30.0+build1/memory/mozalloc/mozalloc.cpp:54
#3 0x00007ffff2ac19d1 in operator new (size=16) at ../../dist/include/mozilla/mozalloc.h:201
#4 nsHTMLStyleSheet::nsHTMLStyleSheet (this=0x7fffd1a89c40, aDocument=<optimized out>) at /build/buildd/firefox-30.0+build1/layout/style/nsHTMLStyleSheet.cpp:234
#5 0x00007ffff2810fee in nsDocument::ResetStylesheetsToURI (this=this@entry=0x7fffd1a9b000, aURI=aURI@entry=0x7fffd25c7be0) at /build/buildd/firefox-30.0+build1/content/base/src/nsDocument.cpp:2428
#6 0x00007ffff281121d in nsDocument::ResetToURI (this=0x7fffd1a9b000, aURI=0x7fffd25c7be0, aLoadGroup=0x7ff
WHAT THIS IS
------------
The DELL LATITUDE E7440's docking station supports two external displays, and
the notebook's Haswell architecture supports having three displays active at
the same time. It works well, but the two external monitors are merged into one
big display:
$ xrandr
Screen 0: minimum 320 x 200, current 5280 x 1080, maximum 32767 x 32767
eDP1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 309mm x 174mm
#!/usr/bin/env perl
use strict;
use v5.10;
use Test::More tests => 2;
require './foo.pl';
is( fooize('test1'), 'foo test1');
is( fooize('test2'), 'foo test2');
#!/bin/bash
# prints a color table of 8bg * 8fg * 2 states (regular/bold)
echo
echo Table for 16-color terminal escape sequences.
echo Replace ESC with \\033 in bash.
echo
echo "Background | Foreground colors"
echo "---------------------------------------------------------------------"
for((bg=40;bg<=47;bg++)); do
#include <stdio.h>
int main (void)
{
int x = 42;
int *px = &x;
int ax[] = {56,57,58,59,60};
char *msg = "OHAI!";
char *pc;
@tene
tene / Foo.pl
Created March 2, 2012 03:56
Problem with setting ASTs in Perl 6 grammars
grammar Foo {
token element {
| 'a' <element> { make 'a' ~ $<element>.ast }
| ';' { make ';' }
}
}
my $m = Foo.parse("aaaa;", :rule('element'));
say $m.gist;
say $m.ast;