Skip to content

Instantly share code, notes, and snippets.

@gbirke
gbirke / fdeploy.sh
Last active May 13, 2019 13:36
WMDE Fundraising deployment shell menu
#!/bin/bash
HEIGHT=15
WIDTH=40
CHOICE_HEIGHT=4
TITLE="Deploy fundraising apps"
MENU="Choose one of the following options:"
OPTIONS=(T "Fundraising Frontend TEST "
L "Fundraising Frontend LAIKA SKIN"
@gbirke
gbirke / test.md
Last active September 12, 2018 09:54
testing hashes in syntax highlighting

Follow these steps:

if [ -f test ]; then
  echo "exists!"
else 
  echo "missing!"
fi
@gbirke
gbirke / dependencies.md
Last active June 7, 2019 13:43
A Wikibase interactive MUD

Node dependencies:

  • wikibase-sdk
  • bluereq
  • vorpal
@gbirke
gbirke / .drone.yml
Last active September 10, 2020 17:54
Notes from my experimentation with Drone CI
---
kind: pipeline
type: docker
name: default
steps:
- name: deploy
image: wikimediade/fundraising-ansible-deploy
pull: never # Until we publish the image
user: ansible
@gbirke
gbirke / factory-callable.php
Last active April 29, 2020 08:50
Dependency inversion of PHP factories with callables
<?php
// This example shows:
// 1) How to invert the dependency of initialization of factories in dependent
// modules by giving a callable. This will defer the initialization of the
// dependency.
// 2) How to use a closure inside of a class as a callable. Notice how accessing
// "$this->presenter" gives the current presenter, not the one that was stored
// when the closure was created.
@gbirke
gbirke / cmds.txt
Created May 1, 2020 22:02
custom rofi menu with tab-separated text file, cut and awk
ls_home>show home> ls ~
ranger> > ranger
config_nvim>Configure NVim> vim -c "cd ~/.config/nvim" ~/.config/nvim/init.vim
# vim: set list listchars:tab=>- noexpandtab tabstop=15
~
@gbirke
gbirke / vimquery.sh
Created May 2, 2020 09:29
Script for NVAlt-like usage of fzf
#!/bin/bash
# A script for use with fzf in a nvalt-like setting
# (Either selecting a file or creating a new one)
# Use like this: fzf --bind "enter:execute(./vimquery {q} {})+abort"
if [ -z "$2" ]; then
if [ ! -z "$1" ]; then
vim "$1.md"
fi
<?php
// This example shows how to override implementations without subclassing,
// using anonymous classes and traits.
interface Animal {
public function makeSound(): string;
public function move(): string;
}
@gbirke
gbirke / unserialize_decode.php
Created August 10, 2021 14:52
Decode PHP-serialized and base64 encoded data in CLI
#!/usr/bin/env php
<?php
if (!empty($argv[1])) {
$data = (string)$argv[1];
} elseif (!stream_isatty(STDIN)) {
$data = stream_get_contents(STDIN);
} else {
echo "Usage: $argv[0] <base64_encoded_serialized_data>\n";
exit(1);