Skip to content

Instantly share code, notes, and snippets.

View geoffjay's full-sized avatar

Geoff Johnson geoffjay

  • Vancouver, BC, Canada
View GitHub Profile
@geoffjay
geoffjay / starship.toml
Last active March 19, 2024 03:57
Starship prompt with nord colors
"$schema" = "https://starship.rs/config-schema.json"
# colorscheme
#
# #2E3440
# #3B4252
# #434C5E
# #4C566A
# #D8DEE9
# #E5E9F0
@geoffjay
geoffjay / .pryrc
Created March 16, 2023 19:26
my .pryrc
# vim:filetype=ruby
# colours
BLACK = "\001\e[0;30m\002"
RED = "\001\e[0;31m\002"
GREEN = "\001\e[0;32m\002"
YELLOW = "\001\e[0;33m\002"
BLUE = "\001\e[0;34m\002"
MAGENTA = "\001\e[0;35m\002"
CYAN = "\001\e[0;36m\002"
@geoffjay
geoffjay / pr-stats.sh
Created November 3, 2022 21:07
GitHub GraphQL API query to get some simple PR metrics
#!/bin/bash -e
QUERY='{
search(type: ISSUE, query: "is:pr state:closed repo:clio/grow", first: 100) {
nodes {
... on PullRequest {
title
number
additions
deletions
#!/bin/bash
# Simple file refactoring for a c project, not intended for use, just
# preserving something I've used a couple of times.
function __refactor {
dir=$(echo $1 | sed 's/\/$//')
files=$(find $dir -type f -regex ".*\.[ch]")
for file in $files; do
new=$(basename $file | sed "s/$2/$3/")
# curl -fLo ~/.gitconfig --create-dirs https://gist.github.com/geoffjay/483828b55925045fc39687bbba573b2f
[user]
name = Geoff Johnson
email = geoff.jay@gmail.com
[alias]
ci = commit -a
co = checkout
cop = checkout @{-1}
/**
* compile:
* gcc -g -o json-hashtable `pkg-config --cflags --libs json-glib-1.0` json-hashtable.c
*
* memcheck:
* G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind --tool=memcheck \
* --leak-check=full --show-leak-kinds=definite --errors-for-leak-kinds=definite \
* --leak-resolution=high --num-callers=20 \
* --suppressions=/usr/share/glib-2.0/valgrind/glib.supp \
* ./json-hashtable
pub fn recv(&mut self) -> Result<Vec<Vec<u8>>, Box<Error>> {
let poller = self.poller.as_mut().unwrap();
let sock = poller.wait::<ZSock>(Some(self.timeout.as_millis() as u32));
let mut resp: Vec<Vec<u8>> = Vec::new();
match sock {
Some(mut sock) => {
let msg = ZMsg::recv::<ZSock>(&mut sock).unwrap();
sock.flush();
#!/bin/bash
sudo dnf -y install https://dl.folkswithhats.org/fedora/$(rpm -E %fedora)/RPMS/fedy-release.rpm
sudo dnf -y install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
sudo dnf -y install fedy
cd /tmp
git clone https://github.com/coanda/dactl.plugin
git clone https://github.com/coanda/dactl-mcc.plugin
sudo cp -R dactl.plugin /usr/share/fedy/plugins/
sudo cp -R dactl-mcc.plugin /usr/share/fedy/plugins/
import { makeExecutableSchema } from 'graphql-tools'
import Configuration from './configuration'
import resolvers from '../resolvers'
const Query = `
type Query {
configuration(id: String!): Configuration
configurations: [Configuration]
}
import Obj from './object'
import Property from './property'
import Plugin from './plugin'
const Configuration = `
type Configuration {
id: String!,
properties: [Property]
plugins: [Plugin]
objects: [Obj]