This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# simplest possible web server | |
# client example: | |
# curl -X POST -H "Content-type: application/json" -d '{"yomama":"sofat"}' http://localhost:8080 && echo | |
require 'webrick' | |
class EchoServlet < WEBrick::HTTPServlet::AbstractServlet | |
def do_POST(request, response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# When you using rspec for commandline tools, and you want to capture stderr in a test, | |
# this method allows you to do it. | |
# It could also be adapted to stdout. | |
# | |
# Use like: | |
# stderr = capture_stderr do | |
# expect{ MyClass.new(arg1, arg2).to raise_error(SystemExit, "my abort message here") | |
# end | |
# | |
# Then you can make expectations based on the variable stderr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# swap.sh: Shows the swap usage of each process | |
# Author: Robert Love | |
swap_total=0 | |
for i in /proc/[0-9]*; do | |
pid=$(echo $i | sed -e 's/\/proc\///g') | |
swap_pid=$(cat /proc/$pid/smaps | | |
awk 'BEGIN{total=0}/^Swap:/{total+=$2}END{print total}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require ::File.expand_path("../../config/load", __FILE__) | |
require 'active_support/core_ext/object/blank' | |
filename = ARGV[0] | |
if filename.present? | |
log = Hookshot::Log.decode(File.read(filename)) | |
if log['hook_response'].eql?('Invalid HTTP Response: 0') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem "typhoeus", '0.6.9' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run with: ansible-playbook -i 'localhost,' -c local -e 'ROLE=docker-host' test.yml | |
--- | |
- hosts: all | |
gather_facts: False | |
tasks: | |
- name: Set env var | |
set_fact: | |
roles: "{{ROLE}}" | |
- name: Debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
RUBY_V = File.open("./.ruby-version") { |f| f.read }.chomp | |
$apt_script = <<SCRIPT | |
sudo apt-get update | |
sudo apt-get install -y git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev libmysqlclient-dev | |
SCRIPT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#se: Setup file for program "(GNU) screen" | |
# written by: Sven Guckes <guckes-screen@math.fu-berlin.de> | |
# Latest change: Mon May 19 01:11:11 CEST 2003 | |
# Latest user version: screen-3.9.15 [2003-03-13] | |
# Length and size: 678 lines and ca 24KB | |
# =============================================================== | |
# | |
# =============================================================== | |
# SEE ALSO: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: add users | |
user: | |
name: "{{ item.name }}" | |
state: present | |
groups: "{{ item.groups }}" | |
shell: /bin/bash | |
with_items: "{{ users }}" | |
- name: add authorized keys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function reminder() { | |
# reminder 5 "remove tea bag" | |
seconds=$(($1 * 60)) | |
sleep $seconds && osascript -e "tell app \"System Events\" to display dialog \"$2\"" 2>&1 > /dev/null | |
} |
OlderNewer