Skip to content

Instantly share code, notes, and snippets.

@gbirke
gbirke / add_github_to_known_hosts.yml
Created March 17, 2016 20:45
Ansible - Add github.com to list of known hosts
- name: Check if github.com is a known host
command: ssh-keygen -H -F github.com -f {{ known_hosts_file }}
register: github_is_known
ignore_errors: True
- name: Add github to known hosts
shell: ssh-keyscan -H github.com >> {{ known_hosts_file }}
when: github_is_known.stdout == ""
@gbirke
gbirke / .alias
Last active May 23, 2016 12:17
Example dotfiles for Ansible playbook introduction
# include in your .bash_profile with "source .alias" or do the following:
# ln -s .alias .bash_aliases
alias ll="ls -al"
alias ..="cd .."
alias ...="cd ../.."
alias pu=pushd
alias po=popd
alias psgrep="psgrep -a"
/**
* Experimental "Send page to alternative render server" gadget
*
* Prerequisites:
* - a running instance of the electron render server (https://github.com/msokk/electron-render-service )
* - add some explanation and a link a link href='#chrome-print' to the page Mediawiki:Coll-rendering_finished_text ( or MediaWiki:Coll-request_failed_msg if you're testing without a working OCG renderer)
*
* Author: Gabriel Birke < [email protected] >
*/
@gbirke
gbirke / logstash-monolog-json-to-plain.conf
Created August 11, 2016 10:42
Convert monolog JSON log to plain output
input {
file {
path => "error.log"
start_position => beginning
ignore_older => 0
codec => json
sincedb_path => "/dev/null"
}
}
@gbirke
gbirke / php.service
Created November 16, 2016 11:13
Example systemd config for local PHP server
[Unit]
Description=PHP Server
After=home.mount network.target
[Service]
User=vagrant
Group=vagrant
ExecStart=/usr/bin/php -S 127.0.0.1:8000 -t /vagrant/www
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
@gbirke
gbirke / adduser_github_sshpub_key.yml
Created March 27, 2017 12:38 — forked from shohey1226/adduser_github_sshpub_key.yml
Ansible playbook add user using public ssh key on Github
---
- name: add user and create ssh key
user: name=shohei
- name: dowanload pubkey from Github and placed as authorized_keys
get_url: url=https://github.com/shohey1226.keys dest=/tmp/shohei.authorized_keys
delegate_to: 127.0.0.1
- name: Create authorized_keys from the file that just downloaded
authorized_key: user=shohei key="{{ lookup('file', '/tmp/shohei.authorized_keys') }}"
@gbirke
gbirke / count_error_severities.jq
Last active August 31, 2019 15:21
jq example files
reduce inputs as $obj (
{};
if $obj.severity == "E" then
. + {
($obj.severity): (.[$obj.severity] + 1)
}
else
.
end
)
@gbirke
gbirke / svg-background-test.html
Created December 29, 2017 09:24
Testing SVG background images
<!DOCTYPE html>
<html>
<head>
<title>SVG-Test</title>
<style>
.foo {
background:url('Thank-you-2017-background-900.svg') no-repeat top center;
background:url('https://upload.wikimedia.org/wikipedia/commons/9/9b/Thank-you-2017-background-1200.svg') no-repeat>
background-size: cover;
height:300px;
@gbirke
gbirke / update_all.sh
Created February 19, 2018 14:54
Update a mediawiki installation from git repositories
#!/bin/sh
echo "Updating core"
git pull
composer update
for e in extensions/*; do
if [ -d "$e" ]; then
cd $e
echo "Updating $(pwd)"
@gbirke
gbirke / php_feature_toggle_review.md
Last active June 11, 2018 08:39
Overview of PHP feature toggle libraries

Overview of PHP feature toggle libraries

Ordered by personal preference, while thinking about using them for https://github.com/wmde/FundraisingFrontend

Pro:

  • Common checks based on user/environment/date are already defined.
  • Provides logging/audit
  • Allows caching of feature sets so feature config does not need to be read on every request
  • Uses PHP 7