Skip to content

Instantly share code, notes, and snippets.

View cstrahan's full-sized avatar

Charles Strahan cstrahan

  • Backtrace
  • Dallas, TX
View GitHub Profile
@cstrahan
cstrahan / profunctorlens.hs
Created February 14, 2016 05:29 — forked from sjoerdvisscher/profunctorlens.hs
Pure profunctor lenses
{-# LANGUAGE Rank2Types #-}
import Control.Applicative (Applicative(..), (<$>), Const(..))
import Control.Lens.Internal.Review (Reviewed(..))
import Control.Lens.Internal.Bazaar (Bazaar(..))
import Data.Monoid (Monoid(..), First(..))
import Data.Profunctor
import Data.Profunctor.Rep
import Data.Functor.Identity
@cstrahan
cstrahan / Categories.hs
Created January 30, 2016 02:05 — forked from ekmett/Categories.hs
UndecidableSuperClasses test case
{-# language KindSignatures #-}
{-# language PolyKinds #-}
{-# language DataKinds #-}
{-# language TypeFamilies #-}
{-# language RankNTypes #-}
{-# language NoImplicitPrelude #-}
{-# language FlexibleContexts #-}
{-# language MultiParamTypeClasses #-}
{-# language GADTs #-}
{-# language ConstraintKinds #-}
@cstrahan
cstrahan / w3m_resizing.patch
Created December 31, 2015 22:44 — forked from fmthoma/w3m_resizing.patch
Fix semi-transparent artifacts in w3m-img when used with 32-bit color (e.g. urxvt)
diff --git a/w3mimg/x11/x11_w3mimg.c b/w3mimg/x11/x11_w3mimg.c
index d24213e..c534393 100644
--- a/w3mimg/x11/x11_w3mimg.c
+++ b/w3mimg/x11/x11_w3mimg.c
@@ -378,6 +378,10 @@ x11_load_image(w3mimg_op * self, W3MImage * img, char *fname, int w, int h)
w = imlib_image_get_width();
if (h <= 0)
h = imlib_image_get_height();
+
+ im = imlib_create_cropped_scaled_image(0, 0, imlib_image_get_width(), imlib_image_get_height(), w, h);
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
@cstrahan
cstrahan / SslClientAuth.hs
Created November 25, 2015 23:29 — forked from superduper/SslClientAuth.hs
Example how to use wreq with ssl
{-# LANGUAGE OverloadedStrings #-}
module Network.HttpSSL (
postSSL
, SSLOptions (..)
) where
{-
build-depends:
wreq
, HsOpenSSL
--- a/w3mimg/x11/x11_w3mimg.c 2004-11-08 12:14:06.000000000 -0500
+++ b/w3mimg/x11/x11_w3mimg.c 2015-03-12 23:23:44.964555734 -0400
@@ -214,9 +214,12 @@
Pixmap p;
GC gc;
XImage *i;
+ XWindowAttributes attr;
+
+ XGetWindowAttributes(xi->display, xi->window, &attr);
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
import Control.Lens
import Data.Maybe
import Data.Monoid
data Constant a b =
Constant a
@cstrahan
cstrahan / tailor.sh
Last active August 29, 2015 14:22 — forked from sinelaw/tailor.sh
#!/bin/bash -eu
LOG_FILE=$1
SB="stdbuf -i0 -oL"
shift
tput sc
$@ 2>&1 | $SB tee $LOG_FILE | $SB cut -c-$(tput cols) | $SB sed -u 's/\(.\)/\\\1/g' | $SB xargs -0 -d'\n' -iyosi -n1 bash -c 'tput rc;tput el; printf "\r%s" yosi'
EXIT_CODE=${PIPESTATUS[0]}
tput rc;tput el;printf "\r" # Delete the last printed line
exit $EXIT_CODE
echo "Flipping tables! (╯°□°)╯︵ ┻━┻"
num_rules=3
real=3 # exposed to the ELB as port 443
test=4 # used to install test certs for domain verification
health=5 # used by the ELB healthcheck
blue_prefix=855
green_prefix=866
build_package_reconfigure() {
test -f configure || autoconf
}
build_package_patch_ruby_railsexpress() {
fetch_git rvm-patchsets git://github.com/skaes/rvm-patchsets.git master
patch -p1 < rvm-patchsets/patches/ruby/2.1.1/railsexpress/01-zero-broken-tests.patch
patch -p1 < rvm-patchsets/patches/ruby/2.1.1/railsexpress/02-improve-gc-stats.patch
patch -p1 < rvm-patchsets/patches/ruby/2.1.1/railsexpress/03-display-more-detailed-stack-trace.patch