Skip to content

Instantly share code, notes, and snippets.

actionjack /
Created Sep 7, 2018 — forked from drmalex07/
An example with an oneshot service on systemd. #systemd #systemd.service #oneshot


Services declared as oneshot are expected to take some action and exit immediatelly (thus, they are not really services, no running processes remain). A common pattern for these type of service is to be defined by a setup and a teardown action.

Let's create a example foo service that when started creates a file, and when stopped it deletes it.

Define setup/teardown actions

Create executable file /opt/foo/


Paper cuts

This is a log of things that have hurt us in the current environment that while not necessarily being technical debt, could possibly be things for us to discuss and possibly fix in the future.

Table of contents

Issue 1

Issue 2

svrist /
Created Feb 7, 2017
Update or create a CloudFormation stack given a name and template + params'
'Update or create a stack given a name and template + params'
from __future__ import division, print_function, unicode_literals
from datetime import datetime
import logging
import json
import sys
import boto3
import botocore
Faheetah / Jenkinsfile.groovy
Last active Jan 13, 2022
Jenkinsfile idiosynchrasies with escaping and quotes
View Jenkinsfile.groovy
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"
rachelmyers /
Last active Oct 1, 2021
How I set up my Chromebooks' dev environment

Chromebook Setup Options

Option 1: Stay in Chrome OS

If you're writing bare-bones javascript for the browser, creating Chrome Apps and Extensions, or using remote coding apps like cloud9, Koding, or Nitrous, you may not need to install Ubuntu. Some tutorials can be done entirely within the browser. The tradeoff is that you won't have a full-featured command line, and you may hit a point where you can't install something that you need.

To start coding within Chrome OS, install Text or Caret as a text editor. (Text stores files in Google Docs and Caret stores the files locally on your machine, which may help you choose.) After that, you're good to go, since Chromebooks come with a browser installed.


actionjack /
Created Nov 25, 2015 — forked from drnic/
A simple concourse example task - fork and try anything

Concourse Tutorial - Example Tasks

This gist includes some job tasks

  • hello-world.yml - displays "hello world"
  • display-other-task.yml - uses this task as a resource itself and displays the hello-world.yml YAML; assumes that the gist is available in the concourse pipeline as resource-gist.
  • display-other-task-renamed-resource-input.yml - is like the task above, but assumes the resource is now named gist rather than resource-gist
keymon /
Last active Aug 29, 2015
GNU plot ab performance and CPU for a tsuru installation

AB benchmark and plotting

Small script to execute a apache benchmark ab from one host to other.

The scripts are designed for benchmark tsuru routers, and compare between hipache+nginx vs. vulcand.

It will gather metrics of request time and CPU in the target so they can be later plot using gnuplot.

phrawzty /
Last active Sep 20, 2021
Use S3 as a Yum repo

S3 as Yum repo

There are two parts to this:

  • Managing access to non-public S3 resources.
  • Building RPM repositories in an automated, deterministic way that Yum can use.


In general, a CentOS 7 x86_64 box in AWS EC2; in specific, this Packer profile.

phrawzty /
Last active Jun 16, 2017
Dealing with extant AWS resources in Terraform

What it is

Problem: Terraform doesn't play nicely with pre-existing infrastructure.

Solution: Officially there isn't one - but here's a work-around that does the trick.


  • Declare a new, temporary resource in your Terraform plan that is nearly identical to the extant resource.
  • Apply the plan, thus instantiating the temporary "twinned" resource and building a state file.
View operating_system.rb
module Gem
class << self
# Returns full path of previous but one directory of dir in path
# E.g. for '/usr/share/ruby', 'ruby', it returns '/usr'
def previous_but_one_dir_to(path, dir)
split_path = path.split(File::SEPARATOR)
File.join(split_path.take_while { |one_dir| one_dir !~ /^#{dir}$/ }[0..-2])