Skip to content

Instantly share code, notes, and snippets.

View meffie's full-sized avatar

Michael Meffie meffie

View GitHub Profile
@meffie
meffie / gist:4f2d1b4ab1d9856cb7d887591c969ba2
Created April 4, 2023 18:00
Using direnv for project specific program versions
We have 2 versions of program foo in /usr/bin/. We want to use foo-v1 in
project_a and foo-v2 in project_b.
$ foo-v1
This is version 1
I am located at /usr/bin/foo-v1
$ foo-v2
This is version 2
@meffie
meffie / settings.json
Created January 20, 2022 13:59
vscode settings for OpenAFS code base.
{
"editor.tabSize": 8,
"editor.insertSpaces": false,
"editor.detectIndentation": false,
"editor.renderWhitespace": "all",
"editor.rulers": [80,120]
}
{"uploader":{"name":"Michael Meffie","email":"mmeffie@sinenomine.net","username":"mmeffie"},"patchSet":{"number":"2","revision":"1e562f8760c0dfa9c037bb3f9b64668ae9e847a1","parents":["39272929fc528a4c6af05e74b98518a3bae18462"],"ref":"refs/changes/11/13411/2","uploader":{"name":"Michael Meffie","email":"mmeffie@sinenomine.net","username":"mmeffie"},"createdOn":1545299856,"author":{"name":"Mark Vitale","email":"mvitale@sinenomine.net","username":"mvitale"},"isDraft":false,"kind":"REWORK","sizeInsertions":2,"sizeDeletions":-2},"change":{"project":"openafs","branch":"openafs-stable-1_8_x","topic":"1.8.3","id":"Ie264fbd0064a3e22b1c474cea59040ecb0804b73","number":"13411","subject":"viced: fix typo in help for option -unsafe-nosalvage","owner":{"name":"Stephan Wiesand","email":"stephan.wiesand@desy.de","username":"wiesand"},"url":"https://gerrit.openafs.org/13411","commitMessage":"viced: fix typo in help for option -unsafe-nosalvage\n\nReviewed-on: https://gerrit.openafs.org/13367\nReviewed-by: Stephan Wiesand \u003c
@meffie
meffie / openafs-wiki-gerrits.py
Created October 12, 2018 14:39
List open gerrits in descending order on wiki.openafs.org
#!/usr/bin/python3
#
# List the gerrits in descending order on wiki.openafs.org.
#
import os
import tempfile
import git_gerrit
from sh.contrib import git
from sh import ErrorReturnCode, ErrorReturnCode_1
@meffie
meffie / check-acinclude-refactor.sh
Last active January 4, 2018 18:13
check openafs acinclude refactor
#!/bin/sh
git clean -d -f -q -x
git fetch https://gerrit.openafs.org/openafs refs/changes/44/12844/3
git checkout FETCH_HEAD
git log -n1 --oneline
echo 0.0.0 >.version # avoid false hunks in diff
./regen.sh -q
mv configure configure.new
mv configure-libafs configure-libafs.new
@meffie
meffie / csdb.py
Created October 12, 2017 21:40
csdb parser
#!/usr/bin/python
import re
import pprint
import urllib2
from sh import rxdebug
def get_csdb():
response = urllib2.urlopen('https://grand.central.org/dl/cellservdb/CellServDB')
return response.read()
@meffie
meffie / Makefile
Last active December 12, 2023 13:26
libyaml examples
all: emit scan parse
emit.o: emit.c
gcc -c emit.c -g -O0 -Wall
emit: emit.o
gcc -o emit emit.o -lyaml
scan.o: scan.c
@meffie
meffie / emit.c
Last active March 7, 2018 09:24
Example libyaml emitter
/*
* Example libyaml emitter.
*
* This is a basic example to demonstrate how to convert raw data to a yaml
* stream using the libyaml emitter API. The example data to be converted is
* is a simple array of structs,
*
* struct fruit data[] = {
* {"apple", "red", 12},
* {"orange", "orange", 3},
@meffie
meffie / afsutil-install-example
Last active March 9, 2017 14:18
Installing an openafs client with afsutil.
$ afstuil build
...
$ sudo afsutil install \
> --dist transarc \
> --comp client \
> --cell sinenomine.net \
> --realm SINENOMINE.NET \
> --hosts afsdb1.sinenomine.net afsdb4.sinenomine.net afsdb5.sinenomine.net
Looking up ip address of hostname afsdb1.sinenomine.net.
Looking up ip address of hostname afsdb4.sinenomine.net.
@meffie
meffie / virsh-domipaddr
Created February 16, 2017 14:48
Get the ip4 addr of a domain with arp. (Helper for old versions of virsh).
#!/bin/sh
#
# Get the ipv4 address of a domain.
#
# Note: This script is obsoleted by modern versions of virsh.
#
name=$1
if [ "x$1" = "x" ]; then
echo "usage: virsh-domipaddr <name>" >&2