Skip to content

Instantly share code, notes, and snippets.

@connrs
connrs / find.sh
Created December 23, 2018 19:14
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
fi
#echo "$f|"$(identify -format '%m' "$f");
@connrs
connrs / LICENSE.md
Last active May 7, 2018 19:32
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
connrs / Foundation.hs
Last active February 10, 2017 20:50
isSuperAdminCheck (Yesod Google Group question)
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"
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;
end;
var
inTri : triangle;
doneyet : Char;
loop : boolean;
@connrs
connrs / keybase.md
Last active August 29, 2015 14:06
keybase.md

Keybase proof

I hereby claim:

  • I am connrs on github.
  • I am connrs (https://keybase.io/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
connrs / ghost
Created February 2, 2014 15:24
Ghost Blog Configuration (Apache, Ubuntu Upstart)
#!/bin/bash
NODE_ENV=production /home/myuser/local/bin/node /home/myuser/www/index.js
@connrs
connrs / gist:5860619
Created June 25, 2013 17:48
Ruby Rogues <-> BeyondPod debugging
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 http://rubyrogues.com/feed started from pos: 0! -------------- (1 ms. since las
@connrs
connrs / delay_with_reset.js
Created March 26, 2013 11:52
Callback delay with reset
// 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);
window.clearTimeout(timeout);
timeout = window.setTimeout(function () {
@connrs
connrs / qsa-polyfill-ie7.js
Created May 18, 2012 09:49
IE7 querySelectorAll polyfill
if (!document.querySelectorAll) {
document.querySelectorAll = function(selector) {
var doc = document,
head = doc.documentElement.firstChild,
styleTag = doc.createElement('STYLE');
head.appendChild(styleTag);
doc.__qsaels = [];
styleTag.styleSheet.cssText = selector + "{x:expression(document.__qsaels.push(this))}";
window.scrollBy(0, 0);