Skip to content

Instantly share code, notes, and snippets.

#!/bin/env ruby
module Vim
module Swapfile
class Parser
ParseTemplate =
[
[:id0, "C"], #char_u b0_id[2]; /* id for block 0: BLOCK0_ID0 and
[:id1, "C"],
[:version, "Z10"], #char_u b0_version[10]; /* Vim version string */
[:page_size, "L"], #char_u b0_page_size[4];/* number of bytes per page */
@nyarly
nyarly / test
Last active July 19, 2016 20:27
#!/usr/local/bin/fish
# XXX use git command to build this
set -l projname swaggering
set -l coverdir /tmp/{$projname}
set -l numpipes 2
set -l filter '\
{ gsub(/.*\\r/, "") };
{ gsub(/.*_obj_test/, ".") };
/^ok|^\?/ { lines = ""; print; next };
@nyarly
nyarly / Example
Last active May 13, 2016 19:12
Jira ticket ids
⮀ jira-issues
DCOPS-7200 Determine image name from source version [Development]
⮀ git jira-branch DCOPS-7200
⮀ git commit -a
<editing>
DCOPS-7200
# Please enter the commit message for your changes. Lines starting
...
⮀ git push
/usr/bin/ruby21 -I/home/judson/.gem/ruby/2.1.0/gems/rspec-support-3.4.1/lib:/home/judson/.gem/ruby/2.1.0/gems/rspec-core-3.4.1/lib /home/judson/.gem/ruby/2.1.0/gems/rspec-core-3.4.1/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
WARN: Unresolved specs during Gem::Specification.reset:
rspec-mocks (~> 3.4.0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
Run options:
include {:focused=>true}
exclude {:rubygems_master=>true, :rubygems=>"=< 2.4.8", :ruby=>"=< 2.1.7", :realworld=>true, :sudo=>true}
All examples were filtered out; ignoring {:focused=>true}
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
@nyarly
nyarly / .gitconfig
Last active January 18, 2016 19:03
[core]
fsyncobjectfiles = false
excludesfile = ~/.config/git/ignore
[user]
email = [email protected]
name = Judson
[branch]
autosetupmerge = true
[color]
branch = true
class Conway
LIVE = true
DEAD = false
def initialize(width, height)
@width, @height = width, height
@board = build_board
end
@nyarly
nyarly / gist:7187c109a58118621ffa
Created October 16, 2015 03:51
Parse unparse
Imagine I've defined a grammar G. It's a ... predicate grammar (I think that's the right term)
such that some of it's rules look like:
KeyValue -> KeyName ': ' ValueString { kv_pair: [key, value] }
KeyName -> [A-Za-z]+ { key: <matchstring> }
ValueString -> [^ ]+ { value: <matchstring> }
A fragment from a string in the language is like
judson: confused
@nyarly
nyarly / git-clean-branches
Created April 29, 2015 00:00
Two scripts for doing branch matainence.
#!/bin/bash
remote=${1:-origin}
declare -a branches
declare -a local_branches
for branch in $(git branch --merged | egrep -v '(^[*])|(master)|(staging)|(production)|(^\s*$)'); do
branch_remote=$(git config --get branch.$branch.remote)
if [ "$branch_remote" == "$remote" ]; then
function autotmux --on-variable TMUX_SESSION_NAME
if test -n "$TMUX_SESSION_NAME" #only if set
if test -z $TMUX #not if in TMUX
tmux new-session -t $TMUX_SESSION_NAME; or tmux new-session -s $TMUX_SESSION_NAME
end
end
end