Skip to content

Instantly share code, notes, and snippets.

connrs /
Created Dec 23, 2018
Random find with imagemagick shit
find . -type f -iname '*.jpg' | while IFS= read -r f; do
_format=$(identify -format '%m' "$f");
if [[ $_format == "JPEG" ]]; then
echo 'File: '$f
ls -lh "$f" | awk '{print $5}'
mogrify -quality 78 "$f"
ls -lh "$f" | awk '{print $5}'
exit 0
#echo "$f|"$(identify -format '%m' "$f");
connrs /
Last active May 7, 2018
mkcarpet - bash script to create a carpet .jar file

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit

connrs / Foundation.hs
Last active Feb 10, 2017
isSuperAdminCheck (Yesod Google Group question)
View Foundation.hs
isAuthorized AssetR _ = isSuperAdmin
isAuthorized HomeR _ = isAuthenticated
-- | Are you logged in?
isAuthenticated :: Handler AuthResult
isAuthenticated =
do muid <- maybeAuthId
return $
case muid of
Nothing -> Unauthorized "You must login to access this page"
View SqTr.hs
module SqTr where
-- Make a square number
squareNumber :: Integer -> Integer
squareNumber = (^2)
-- Make a triangle numnber
triNumber :: Integer -> Integer
triNumber x = fromIntegral (round (x' * (x' + 1) * 0.5)) :: Integer
where x' = fromInteger x
program trTriangle;
uses crt;
type triangle = record
len : Array[0..2] of Real;
Scal,Isos,Equi,Obtu,RAng,Refl : Boolean;
inTri : triangle;
doneyet : Char;
loop : boolean;
connrs /
Last active Aug 29, 2015

Keybase proof

I hereby claim:

  • I am connrs on github.
  • I am connrs ( on keybase.
  • I have a public key whose fingerprint is E44C 6877 AC53 6B57 D52C 642B 0F34 2407 81A7 33B9

To claim this, I am signing this object:

connrs / ghost
Created Feb 2, 2014
Ghost Blog Configuration (Apache, Ubuntu Upstart)
View ghost
NODE_ENV=production /home/myuser/local/bin/node /home/myuser/www/index.js
connrs / gist:5860619
Created Jun 25, 2013
Ruby Rogues <-> BeyondPod debugging
View gist:5860619
61:I/ActivityManager( 1991): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=mobi.beyondpod cmp=mobi.beyondpod/.ui.views.Splash bnds=[221,392][319,539] u=0} from pid 2463
77:I/ActivityManager( 1991): START {typ=1b9190fc-7bef-4002-afe7-4e12f6eeb3c1 cmp=mobi.beyondpod/.ui.views.feedsettings.FeedPropertiesView (has extras) u=0} from pid 8492
192:I/ActivityManager( 1991): START {dat=feed://feed/1b9190fc-7bef-4002-afe7-4e12f6eeb3c1 cmp=mobi.beyondpod/.ui.views.FeedContentViewActivity u=0} from pid 8492
219:I/ActivityManager( 1991): START {typ=1b9190fc-7bef-4002-afe7-4e12f6eeb3c1 cmp=mobi.beyondpod/.ui.views.feedsettings.FeedPropertiesView (has extras) u=0} from pid 8492
315:V/BeyondPod( 8492): Repository save started... (34.86 s. since last trace) [FeedRepository]
316:V/BeyondPod( 8492): (3 ms. since last trace) [DownloadAgent]
317:V/BeyondPod( 8492): >> -------------- Download of started from pos: 0! -------------- (1 ms. since las
connrs / delay_with_reset.js
Created Mar 26, 2013
Callback delay with reset
View delay_with_reset.js
// I just wanted a quick reference for this function as it's a common pattern
// used when managing DOM events that may fire multiple times in a short period
// of time.
function delayWithReset(delayMilliseconds, callback) {
var timeout = null;
var func = function() {
var args = Array.prototype.slice.apply(arguments);
timeout = window.setTimeout(function () {
connrs / qsa-polyfill-ie7.js
Created May 18, 2012
IE7 querySelectorAll polyfill
View qsa-polyfill-ie7.js
if (!document.querySelectorAll) {
document.querySelectorAll = function(selector) {
var doc = document,
head = doc.documentElement.firstChild,
styleTag = doc.createElement('STYLE');
doc.__qsaels = [];
styleTag.styleSheet.cssText = selector + "{x:expression(document.__qsaels.push(this))}";
window.scrollBy(0, 0);