Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
DevOps for VA.gov's CMS

Elijah Lynn ElijahLynn

💭
DevOps for VA.gov's CMS
View GitHub Profile
@ElijahLynn
ElijahLynn / gist:239d9f287757132bf025bae198a635ac
Created Nov 24, 2016
Fix Ubuntu 14.04 Magic mouse speed and scrolling
View gist:239d9f287757132bf025bae198a635ac
sudo rmmod hid_magicmouse
sudo modprobe hid_magicmouse scroll-speed=50 scroll-acceleration=1
xinput --set-prop "Elijah's mouse" "Device Accel Constant Deceleration" 5
@ElijahLynn
ElijahLynn / replify
Created Aug 19, 2016 — forked from danielrw7/ replify
replify - Create a REPL for any command
View replify
#!/bin/sh
command="${*}"
printf "Initialized REPL for [%s]\n" "$command"
printf "%s> " "$command"
read -r input
while [ "$input" != "" ];
do
eval "$command $input"
printf "\n%s> " "$command"
View syncdb manual gnu parallel import command
find /tmp/user/1000/syncdb/loc_mvpd_admin -name '*sql' | parallel --use-cpus-instead-of-cores --jobs 700% -v drush sql-query --file={}
@ElijahLynn
ElijahLynn / pagination.md
Created Feb 2, 2016 — forked from mislav/pagination.md
"Pagination 101" by Faruk Ateş
View pagination.md

Pagination 101

Article by Faruk Ateş, [originally on KuraFire.net][original] which is currently down

One of the most commonly overlooked and under-refined elements of a website is its pagination controls. In many cases, these are treated as an afterthought. I rarely come across a website that has decent pagination, and it always makes me wonder why so few manage to get it right. After all, I'd say that pagination is pretty easy to get right. Alas, that doesn't seem the case, so after encouragement from Chris Messina on Flickr I decided to write my Pagination 101, hopefully it'll give you some clues as to what makes good pagination.

Before going into analyzing good and bad pagination, I want to explain just what I consider to be pagination: Pagination is any kind of control system that lets the user browse through pages of search results, archives, or any other kind of continued content. Search results are the o

@ElijahLynn
ElijahLynn / pipe_to_docker_examples
Last active Jan 24, 2021
How to pipe to `docker exec` examples
View pipe_to_docker_examples
# These examples assume you have a container currently running.
# 1 Pipe from a file
sudo docker exec --interactive CONTAINER_NAME /bin/bash < the_beginning.sh | tee the_beginning_output.txt`
#2a Pipe by piping
echo "echo This is how we pipe to docker exec" | sudo docker exec --interactive CONTAINER_NAME /bin/bash -
@ElijahLynn
ElijahLynn / purge-ban-domain-varnish.md
Created Jan 21, 2016 — forked from aderowbotham/purge-ban-domain-varnish.md
Purge (ban) an entire domain in Varnish Cache 3
View purge-ban-domain-varnish.md

How to purge ('ban') an entire domain in Varnish Cache 3

#####EDIT: NB Ban is technically different from Purge. Banned objects remain in memory but banning is faster than purging. Read the Varnish 3 documentation here and here.

Purge may be a more appropriate action for your use-case; although the examples in the gist below work, it's not necessarily the best way of doing this.


@ElijahLynn
ElijahLynn / pdfcrop.sh
Created Jan 13, 2016
Replacement of the Perl pdfcrop, this one is in Bash.
View pdfcrop.sh
#!/bin/bash
# http://tex.stackexchange.com/questions/42236/pdfcrop-generates-larger-file/42259#42259
function usage () {
echo "Usage: `basename $0` [Options] <input.pdf> [<output.pdf>]"
echo
echo " * Removes white margins from every page in the file. (Default operation)"
echo " * Trims page edges by given amounts. (Alternative operation)"
echo
View gist:0ac462870ea703cc77a5
# Fish while loop example
# This was to come up with how many URLs I could fit in the 50KB max purge request to Akamai for invalidation purges.
while test (du -b /tmp/ak | awk '{print $1}') -lt 50001
echo (du -b /tmp/ak | awk '{print $1}') bytes
echo "https://community.akamai.com/thread/2706" >> /tmp/ak; echo (wc -l /tmp/ak | awk '{print $1}' ) lines
end
View amazons3.module
function amazons3_stream_wrappers() {
// This hook is called before hook_init(), so we have to manually register
// the autoloader. We also need to handle module upgrades where
// composer_manager might not be enabled yet.
if (!module_exists('composer_manager')) {
return array();
}
// If the module has been enabled, but the user didn't update composer