Skip to content

Instantly share code, notes, and snippets.

View stemwinder's full-sized avatar

Joshua Smith stemwinder

View GitHub Profile
#!/bin/bash
function switch_files {
mv $1.png $1.tmp.png
mv $1-inverse.png $1.png
mv $1.tmp.png $1-inverse.png
mv $1@2x.png $1@2x.tmp.png
mv $1[email protected] $1@2x.png
mv $1@2x.tmp.png $1[email protected]
}
@stemwinder
stemwinder / unrar-batch.sh
Last active August 29, 2015 14:15
Recursive Unrar
# Source: http://www.beginninglinux.com/home/data-compression/unrar-all-files-from-multiple-subdirectories-at-once
# simple: unrar e -r *.rar
unrar e -r -o- /home/username/source/directory/*.rar /home/username/copy/extracted/to
# Delete after extraction
find ./ -name "*.r*" -delete
@stemwinder
stemwinder / lftp-seg.sh
Created January 26, 2015 20:33
Segmented file transfer over SSH/sFTP
# Source: http://sysadmin.compxtreme.ro/segmented-file-transfer-over-ssh/
lftp sftp://user[:password]@host.ro[:port] -e "mirror -c --parallel=5 --use-pget-n=5 \"/path/to/folder/\""
@stemwinder
stemwinder / trello-ansel.css
Last active August 29, 2015 14:12
Trello user style inspired by Trello Clear & Ansel Adams
/* =================================================
Trello Ansel
---
Inspired by Ansel Adams & based on Trello Clear
by angelon (https://userstyles.org/users/202251)
================================================= */
@-moz-document domain('trello.com'), url-prefix('https://trello.com/b') {
body {
background-color: #fff !important;
body {
background: #f8f8f7 !important;
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif !important;
font-weight: 300 !important;
}
h3 {font-weight:300 !important}
.header-woof {display:none !important}
#header {
background: #2B2B2B !important;
padding: 10px !important;
}
.header-user {
top: 10px !important;
right: 5px !important;
}
html,body,input,select,textarea,button {
font:13px 'Tahoma',sans-serif!important;
line-height:17px!important;
font-weight:300!important;
}
.list-card a {
color:#444!important;
}
/*
* Subtler, clearer colors and edges
* Emphsasize first two lists
* -- can be modified in CSS to include fewer or more lists
*/
* {
border-radius: 0 !important;
}
@stemwinder
stemwinder / tar-with-pigz.sh
Created December 12, 2014 20:44
Compress TAR archive with pigz using n-threads
tar cvf - paths-to-archive | pigz -9 -p 32 > archive.tar.gz
@stemwinder
stemwinder / join_singlerow-only.sql
Last active August 29, 2015 14:11
SQL query that joins only one row from a relationship set using a derived table.
SELECT i.*, a.*
FROM inet_obdg_items i
JOIN inet_obdg_actions a ON a.item_id = i.id
JOIN (
SELECT derived_latest.item_id, MAX(derived_latest.id) AS latest_action_id
FROM inet_obdg_actions derived_latest
WHERE derived_latest.deleted_at IS NULL
GROUP BY derived_latest.item_id
) z ON z.item_id = a.item_id
AND z.latest_action_id = a.id