Skip to content

Instantly share code, notes, and snippets.

View abackstrom's full-sized avatar

Annika Backstrom abackstrom

View GitHub Profile
ssh vm 'cat sourcefile.tar' | pv -s $(ssh vm 'stat -c %s sourcefile.tar') | ssh someserver 'cat >destfile.tar'
scala> List("Annika", "Backstrom").map({ s: String => s.toUpperCase() })
res12: List[String] = List(ANNIKA, BACKSTROM)
scala> List("Annika", "Backstrom").map({ _.toUpperCase() })
res13: List[String] = List(ANNIKA, BACKSTROM)
scala> List("Annika", "Backstrom").map({ _.toUpperCase })
res14: List[String] = List(ANNIKA, BACKSTROM)
scala> List("Annika", "Backstrom").map { _.toUpperCase }

Before:

function the_thing() {
    echo "haha CODE";
}

After:

@abackstrom
abackstrom / server.py
Last active December 23, 2015 01:48
Sample Python server to return formatted data for GeekTool.
#!/usr/bin/env python
#
# Run this in the background. Poll using netcat:
#
# $ nc localhost 5005
#
# Made for use with GeekTool. http://projects.tynsoe.org/en/geektool/
#
@abackstrom
abackstrom / highlight.sh
Last active December 21, 2015 23:59
Series of scripts to send syntax-highlighted email from the command line. Sample usage: git diff | highlight | vipe | pmail -t team@company.com -s "Code Review"
#!/bin/bash
if [ -n "$1" ] ; then
pygmentize -O full -f html "$@"
else
pygmentize -O full -f html -g
fi
@abackstrom
abackstrom / gist:6106159
Last active December 20, 2015 09:09
Weechat configuration to customize the hotlist. Cycle through buffers with alt-a. See Notify Levels: http://weechat.org/files/doc/devel/weechat_user.en.html#notify_levels.
/set weechat.look.buffer_notify_default highlight
/set weechat.notify.irc.freenode.#wordpress all
/set weechat.notify.irc.freenode.#pelican all
@abackstrom
abackstrom / gist:5799310
Created June 17, 2013 18:54
Enable GitHub "Repository Next"
$('<a href="/users/' + $("#js-command-bar-field").data('username') + '/enable_repository_next" class="button minibutton flash-action blue" data-method="post">Enable Repository Next</a>').appendTo(document.body).click()
@abackstrom
abackstrom / gist:5526832
Last active December 17, 2015 01:10
Lua-driven nginx config to make my website's SSL redirect work with App.net domain validation. App.net does not follow redirects during the validation process. This config ensures the validator gets a response code and body it understands.
# http->https redirect
server {
listen 207.192.74.235:80;
server_name sixohthree.com;
include logging.conf;
access_log /var/www/sixohthree.com/logs/access_log custom;
error_log /var/www/sixohthree.com/logs/error_log error;
location / {
Index: domain_mapping.php
===================================================================
--- domain_mapping.php (revision 9545)
+++ domain_mapping.php (revision 9553)
@@ -515,27 +515,37 @@
}
-function domain_mapping_siteurl( $setting ) {
- global $wpdb, $current_blog;
+function domain_mapping_siteurl( $setting, $blog_id = 0 ) {
@abackstrom
abackstrom / gist:4611843
Last active December 11, 2015 14:08
post-commit hook for @mikesusz
#!/bin/sh
# curl https://gist.github.com/raw/4611843/gistfile1.sh > .git/hooks/post-commit && chmod +x .git/hooks/post-commit
git diff-tree -p HEAD^ | grep livereload 2>&1 >/dev/null
if [ $? -eq 0 ] ; then
echo -e "\e[0;31m!!! Don't commit livereload stuff. --amend that commit.\e[0m"
fi