Skip to content

Instantly share code, notes, and snippets.

@mikesimons
mikesimons / flowdark.css
Created February 17, 2017 10:42
Stylish stylesheet for nicer looking flowdark theme for flowdock
/* Add this as a stylish stylesheet for www.flowdock.com */
/* Extension: https://chrome.google.com/webstore/detail/stylish-custom-themes-for/fjnbnpbmkenffdnngjfgmeleoegfcffe?hl=en */
/* Scrollbar */
::-webkit-scrollbar {
width: 5px;
height: 5px;
}
::-webkit-scrollbar-thumb {
background: #2a353a;
@mikesimons
mikesimons / shmcounter.sh
Created February 2, 2017 15:19
Hacky script to detect containers binding /var/lib/docker causing issues on < 3.19 kernels
#!/bin/bash
# See https://github.com/docker/docker/issues/17902 for context
containers=($(docker ps --format="{{ .ID }}"))
for id in "${containers[@]}"; do
pid="$(docker top "$id" | tail -n+2 | head -n1 | awk '{ print $2 }')"
count="$(findmnt --task "$pid" | grep -c /shm)"
echo "$id: $count"
@mikesimons
mikesimons / ssh-test.sh
Created April 7, 2016 10:53
Script for testing access to a single ssh host.Loop with something like: cat ~/my-hosts | xargs -I X bash -c 'echo -n "X: " && ssh-test.sh myusername@X'
#!/bin/bash
main() {
declare host="$1"
ssh -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no -oBatchMode=yes -oConnectTimeout=5 -vvv $host -- exit > /tmp/sshtest 2>&1
if [[ $? == 0 ]]; then
echo "OK"
exit
fi
meta:
name: Redis example
description: This is an example of a master / slave redis configuration.
type: redis
units:
frontend:
service:
port: 80
controller:
Thread #1
["[lib/vagrant/batch_action.rb:126:in `join',
lib/vagrant/batch_action.rb:126:in `block in run',
lib/vagrant/batch_action.rb:65:in `each',
lib/vagrant/batch_action.rb:65:in `run',
lib/vagrant/environment.rb:241:in `block (2 levels) in batch',
lib/vagrant/environment.rb:236:in `tap',
lib/vagrant/environment.rb:236:in `block in batch',
lib/vagrant/environment.rb:235:in `synchronize',

Keybase proof

I hereby claim:

  • I am mikesimons on github.
  • I am mikesimons (https://keybase.io/mikesimons) on keybase.
  • I have a public key whose fingerprint is 38BB 52A4 852A ECB5 2021 7674 2473 54C1 C2F4 0EAF

To claim this, I am signing this object:

if node["apache"] && node["apache"]["sites"]
node["apache"]["sites"].each do |name, site|
web_app name do
server_name name
server_aliases site["aliases"] || []
docroot site["docroot"]
application_name site["application_name"] || name
if !site["template_cookbook"]
cookbook "apache"
@mikesimons
mikesimons / calc.rb
Last active January 3, 2016 14:39
String calculator kata
class StringCalculator
def calculate string = ""
string.split(/\D+/).map do |number|
number.to_i
end.reduce(&:+).to_i
end
end
@mikesimons
mikesimons / gist:6114028
Created July 30, 2013 15:31
Hangouts mangling for Stylish extension. Probably flakey, definitely breaks shit. Proof of concept only
.PD {
padding: 5px;
}
.JL {
padding-left: 120px;
}
.pj>.Tn {
float: none;
@mikesimons
mikesimons / codemirror-abuse-primer.js
Created June 27, 2012 11:23
Primer for CodeMirror mode abuse
var code = "function func_name() { var something = 'abc'; return 1; }";
var js_mode = CodeMirror.modes["javascript"]({}, {});
var state = js_mode.startState();
var stream = new CodeMirror.StringStream(code);
var style = null;
while(!stream.eol()) {
style = js_mode.token(stream, state);