Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View ElijahLynn's full-sized avatar
😎
All Your DevOps Belong To Us

Elijah Lynn ElijahLynn

😎
All Your DevOps Belong To Us
View GitHub Profile
@ElijahLynn
ElijahLynn / purge-ban-domain-varnish.md
Created January 21, 2016 19:50 — forked from aderowbotham/purge-ban-domain-varnish.md
Purge (ban) an entire domain in Varnish Cache 3

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 January 13, 2016 00:03
Replacement of the Perl pdfcrop, this one is in Bash.
#!/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
@ElijahLynn
ElijahLynn / springer-free-maths-books.md
Created December 29, 2015 03:23 — forked from bishboria/springer-free-maths-books.md
Springer have made a bunch of maths books available for free, here are the direct links
# 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
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
http://askubuntu.com/a/620985/11929
GIT_SSH_COMMAND="ssh -v"
git clone example
@ElijahLynn
ElijahLynn / ckeditor-3.0.js
Last active August 29, 2015 14:18
Line 15-22
insert: function(content) {
content = this.prepareContent(content);
if (CKEDITOR.env.webkit || CKEDITOR.env.chrome || CKEDITOR.env.opera || CKEDITOR.env.safari) {
// Works around a WebKit bug which removes wrapper elements.
// @see https://drupal.org/node/1927968
var tmp = new CKEDITOR.dom.element('div'), children, skip = 0, item;
tmp.setHtml(content);
children = tmp.getChildren();
skip = 0;
while (children.count() > skip) {
@ElijahLynn
ElijahLynn / gist:a848ae3214aba1f22745
Last active February 16, 2021 02:17
Cherry pick range commits from another repo
// Say you have a Repo and you are in a few levels deep. /profiles/publisher/modules/contrib/
// You have a module called ../contrib/embed_external
// You want to pull changes you made to it to upstream
// pwd ../contrib
// git clone embed-external-upstream EE-upstream
// cd EE-upstream
git -C ../embed_external/ diff --relative 76da308..HEAD . | patch -p1
// http://stackoverflow.com/a/9507417/292408
@ElijahLynn
ElijahLynn / meetupWaitlistNumber
Created March 10, 2015 18:11
meetupWaitlistNumber
// Taken from comment by Eli Hellmann @ http://www.meetup.com/AngularJS-NYC/events/221056642
Array.prototype.reduce.call($('#rsvp-list-waitlist li'), function(agg,e,i){return agg || (/Elijah Lynn/i.test($(e).text()) ? i : agg);},null) //:)
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
dev.vm.synced_folder pubstack_config['synced_folder'], '/var/www/html',
type: synced_folder_type,
mount_options: ['rw', 'vers=3', 'tcp', 'fsc', 'actimeo=1']