Skip to content

Instantly share code, notes, and snippets.

View cirocosta's full-sized avatar

Ciro S. Costa cirocosta

View GitHub Profile
@cirocosta
cirocosta / dump.sh
Created May 29, 2019 19:59
Get golang dumps from BOSH deployed concourse
#!/bin/bash
set -o errexit
set -o nounset
set -o xtrace
readonly DUMP_PREFIX="/tmp/dump.$(date +%Y-%m-%d)"
readonly INSTANCE_GROUP=${INSTANCE_GROUP:-web}
[2938142.956375] INFO: task link:3239126 blocked for more than 120 seconds.
[2938142.963358] Tainted: G W 4.15.0-45-generic #48~16.04.1-Ubuntu
[2938142.971542] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[2938142.979964] link D 0 3239126 3232390 0x000001a0
[2938142.979969] Call Trace:
[2938142.979980] __schedule+0x3d6/0x8b0
[2938142.979984] ? __switch_to_asm+0x40/0x70
[2938142.979986] schedule+0x36/0x80
[2938142.979988] schedule_timeout+0x1db/0x370
[2938142.979991] wait_for_completion+0xb4/0x140
@cirocosta
cirocosta / apfs.sh
Created March 15, 2019 12:47
a "baggageclaim-driver"-a-like script leveraging `hdiutil` and `clonefile(2)`
#!/bin/bash
# apfs - a "baggageclaim-driver"-a-like script leveraging `hdiutil` and
# `clonefile(2)`.
#
# Usage: apfs.sh (create|cow|destroy)
#
# Commands:
# create vol-id desc: creates a volume
# cow vol-id parent-vol-id desc: creates a cow layer based on `parent-vol-id`
#!/bin/bash
# Usage: ./script.sh arg1
#
# Arg1: the number of the loopback device to create
# (must be a number that does not match the entries under
# /dev/loop<N>)
#
# e.g.: if `ls /dev` shows /dev/loop{0,1,2}, here you can
# use something like `10`.
resources:
- name: periodically
type: time
source:
interval: 15s
- name: httpstat-image
type: registry-image
source:
repository: concourse/test-pivnet-resource-http-stat
@cirocosta
cirocosta / script.sh
Created November 20, 2018 18:45
Creates a loopback device w/ btrfs, creates a base volume and then a bunch of COWs based on the base volume.
#!/bin/bash
# Usage: ./script.sh arg1
#
# Arg1: the number of the loopback device to create
# (must be a number that does not match the entries under
# /dev/loop<N>)
#
# e.g.: if `ls /dev` shows /dev/loop{0,1,2}, here you can
# use something like `10`.
@cirocosta
cirocosta / main.go
Created November 6, 2018 02:00
Capturing errors on a deferred statement
package main
import (
"fmt"
"os"
"code.cloudfoundry.org/lager"
)
// methodThatFails simply always fails, returning an
@cirocosta
cirocosta / main.yml
Created October 8, 2018 20:31
bpftrace ansible role (from https://github.com/cirocosta/mylinux)
---
- name: 'add llvm apt key'
apt_key:
url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
state: 'present'
- name: 'add llvm apt repo'
apt_repository:
repo: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-6.0 main'
state: 'present'
@cirocosta
cirocosta / status.lua
Last active January 8, 2022 17:23
Returns a 200OK as a status check (haproxy)
status = {}
status.version = "0.0.1"
status.startup = function()
core.Info("[status] status script v" .. status.version);
end
status.run = function(applet)
local response = "200 OK"
# Execute the command `echo test`
# against the hosts described in `/tmp/hosts`
# without performing host key checking
# and SSHing as `ubuntu`
mpssh \
--user ubuntu \
--nokeychk \
--file /tmp/hosts \
'echo "test"'