Skip to content

Instantly share code, notes, and snippets.

Annika Backstrom abackstrom

Block or report user

Report or block abackstrom

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@abackstrom
abackstrom / php.vim.patch
Created Nov 12, 2019
Basic patch for syntax/php.vim support of "flexible" heredoc
View php.vim.patch
--- a/syntax/php.vim 2018-11-30 16:50:41.000000000 +0000
+++ b/syntax/php.vim 2019-11-12 21:23:05.870740817 +0000
@@ -379,18 +379,18 @@
syn case match
" HereDoc
-syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\I\i*\)\2$" end="^\z1\(;\=$\)\@=" contained contains=phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar,@Spell keepend extend
+syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\I\i*\)\2$" end="^\s*\z1\(;\=$\)\@=" contained contains=phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar,@Spell keepend extend
" including HTML,JavaScript,SQL even if not enabled via options
-syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)\2$" end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar,@Spell keepend extend
@abackstrom
abackstrom / exercise-equivalent-binary-trees.go
Last active Feb 26, 2018
My solution for Go Tour Concurrency Exercise "Equivalent Binary Trees"
View exercise-equivalent-binary-trees.go
package main
import (
"fmt"
"golang.org/x/tour/tree"
)
// Walk walks the tree t sending all values
// from the tree to the channel ch.
func Walk(t *tree.Tree, ch chan int) {
View gpio.go
package main
// Pinout https://forums.ni.com/legacyfs/online/202279_Main%20Pinout.png
// Pibrella (Python) https://github.com/pimoroni/pibrella/blob/master/library/pibrella/__init__.py
// go-rpio https://github.com/stianeikeland/go-rpio/blob/master/rpio.go
import (
"fmt"
"github.com/stianeikeland/go-rpio"
"os"
@abackstrom
abackstrom / gist.go
Last active Feb 24, 2018
This gist was created by the gisted code. Self-gisting! This is the first complete Go program I've ever written.
View gist.go
package main
import (
"bytes"
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"net/http"
"os"
@abackstrom
abackstrom / novel
Last active Jun 30, 2017
PHP: Using a child process for text transformations without blocking
View novel
Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. It is a way I have of driving off the spleen and regulating the circulation. Whenever I find myself growing grim about the mouth; whenever it is a damp, drizzly November in my soul; whenever I find myself involuntarily pausing before coffin warehouses, and bringing up the rear of every funeral I meet; and especially whenever my hypos get such an upper hand of me, that it requires a strong moral principle to prevent me from deliberately stepping into the street, and methodically knocking people’s hats off—then, I account it high time to get to sea as soon as I can. This is my substitute for pistol and ball. With a philosophical flourish Cato throws himself upon his sword; I quietly take to the ship. There is nothing surprising in this. If they but knew it, almost all men in their degree, s
View keybase.md

Keybase proof

I hereby claim:

  • I am abackstrom on github.
  • I am abackstrom (https://keybase.io/abackstrom) on keybase.
  • I have a public key ASD-ihbCAkm3yzj2QzyXcSMqQnEdaWv96J_SYtaF1AXlzwo

To claim this, I am signing this object:

View gist:b8ecd3c02ebeee8636c8
# get page # of 'last' page
curl -si https://github.<yourdomain>.com/api/v3/users/abackstrom/gists?access_token=$TOKEN | grep ^Link:
# download json metadata for all gists. use the right page range! curl expands the bracketed range
curl "https://github.<yourdomain>.com/api/v3/users/abackstrom/gists?access_token=$TOKEN&page=[1-27]" -o gists_#1.json
# clone all the repos
# install jq first. http://stedolan.github.io/jq/
jq -r '.[] | .git_pull_url' *.json | while read repo ; do git clone $repo ; done
View gist:5c1c74f3fdabf6a648a8
~$ sudo php-build 5.6.5 /usr/local
[Info]: Loaded extension plugin
[Info]: Loaded apc Plugin.
[Info]: Loaded composer Plugin.
[Info]: Loaded pyrus Plugin.
[Info]: Loaded uprofiler Plugin.
[Info]: Loaded xdebug Plugin.
[Info]: Loaded xhprof Plugin.
[Info]: php.ini-production gets used as php.ini
[Info]: Building 5.6.5 into /usr/local
View gist:c38253a4fcf0b54b96dc
var irc = require('irc');
var client = new irc.Client('irc.freenode.net', 'somebot', {
channels: ['##remotes'],
});
client.addListener('message##remotes', function (from, to, message) {
client.say("##remotes", from + ": i agree");
});
View gist:cf951f04e2439879fe38
ssh vm 'cat sourcefile.tar' | pv -s $(ssh vm 'stat -c %s sourcefile.tar') | ssh someserver 'cat >destfile.tar'
You can’t perform that action at this time.