Skip to content

Instantly share code, notes, and snippets.

View eltone's full-sized avatar

Anthony Hobbs eltone

  • NaturalMotion Games Ltd
  • London, UK
View GitHub Profile
@codemedic
codemedic / vpn-docker-fix
Last active May 23, 2025 13:50
Docker network through host IPSec / Strongswan VPN
#!/usr/bin/env bash
# Link up docker network via IPSec VPN on docker-host.
#
# NOTE: This script can either be "sourced" into your .bashrc or executed directly. Be
# it sourced or executed, the usage syntax below is the same.
#
# Usage: [dry_run=1] [debug=1] vpn-docker-fix [docker-network-1 [docker-network-2 ...]]
#
# Env Variables:
@JunichiIto
JunichiIto / alias_matchers.md
Last active September 5, 2025 14:24
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
@cowboy
cowboy / #bf4-emblem-import-export.md
Last active April 29, 2025 16:39
JavaScript: BF4 Battlelog Emblem Import / Export

Exporting an emblem

  1. Log into BF4 Battlelog.
  2. Visit the Customize emblem page.
  3. Select the emblem you wish to export.
  4. Open the console (Ctrl-Shift-J).
  5. Enter the following code snippet to copy the raw emblem data to the clipboard:
    copy('emblem.emblem.load('+JSON.stringify(emblem.emblem.data,null,2)+');');
  6. Paste somewhere useful, like a gist. Whatever.
  7. Close the console (Ctrl-Shift-J).
@lloydmeta
lloydmeta / string_extensions.rb
Created June 6, 2013 09:37
Methods to split a Ruby string into continuous CJK (Chinese/Japanese/Korean) and alphabetical string segments.
# encoding: UTF-8
class String
def contains_cjk?
!!(self =~ /\p{Han}|\p{Katakana}|\p{Hiragana}|\p{Hangul}/)
end
def for_each_continous_cjk_alpha_part
split_into_cjk_alpha_phrases.each.with_index do |part, i|
@clusterfudge
clusterfudge / setup-statsd-and-graphite.sh
Created March 25, 2013 23:25
Setting up statsd, graphite, and carbon from scratch on a vanilla ubuntu 12.04 LTS install in azure
#!/bin/bash
# node.js using PPA (for statsd)
sudo apt-get install python-software-properties
sudo apt-get install nodejs npm
# Install git to get statsd
sudo apt-get install git
# System level dependencies for Graphite
module RetryableTyphoeus
require 'typhoeus'
include Typhoeus
DEFAULT_RETRIES = 1
class Request < Typhoeus::Request
def original_on_complete=(proc)
@original_on_complete = proc
@bhang
bhang / install_graphite_statsd_ubuntu_precise.sh
Created May 15, 2012 17:41
Install Graphite and statsd on Ubuntu 12.04 LTS (Precise Pangolin)
#!/bin/bash
# node.js using PPA (for statsd)
sudo apt-get install python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm
# Install git to get statsd
sudo apt-get install git