Skip to content

Instantly share code, notes, and snippets.

@willejs
willejs / README.md
Last active January 4, 2023 09:39
Moving Concourse Pipelines

Moving Concourse Pipelines

Currently concourse does not support moving pipelines between teams via fly CLI. There is an issue for that here

The only way to do this is to make a few changes in the DB.

If you run the statement below you will see that 6 tables have the team_id column.

concourse=> select table_name                                                                                                                                                                                                                                                                                                                                                       from INFORMATION_SCHEMA.COLUMNS                                                                                                                                                                                                                                                                            
@willejs
willejs / hello.yaml
Last active July 6, 2016 15:57
Example kubernetes deployment and service
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: hello
spec:
replicas: 1
template:
metadata:
labels:
app: hello
### Keybase proof
I hereby claim:
* I am willejs on github.
* I am willejs (https://keybase.io/willejs) on keybase.
* I have a public key whose fingerprint is E3E2 C6EE 4EAF 484D B409 8740 DDF7 7F0E B08F 6896
To claim this, I am signing this object:
@willejs
willejs / gist:347ec18cd4683bbab5a3
Last active August 29, 2015 14:19
sprout-wrap-bootstrap
#!/bin/bash
set -e
# Read SPROUTREPO from environment or use default crowdsurge repo
: ${SPROUTREPO:="https://github.com/crowdsurge/sprout-wrap.git"}
### Define some helper functions ###
usage() {
cat << _EOF_
Usage: "$0" [options]
package[uchiwa] (uchiwa::repo line 56) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '100'
---- Begin output of apt-get -q -y --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" install uchiwa=0.4.1-1 ----
STDOUT: Reading package lists...
Building dependency tree...
Reading state information...
STDERR: E: Version '0.4.1-1' for 'uchiwa' was not found
---- End output of apt-get -q -y --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" install uchiwa=0.4.1-1 ----
Ran apt-get -q -y --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" install uchiwa=0.4.1-1 returned 100
@willejs
willejs / gist:043ffaeec61c4501760e
Created February 12, 2015 21:46
haproxy 1.5 logstash grok filter - working!
HAPROXYTIME (?!<[0-9])%{HOUR}:%{MINUTE}(?::%{SECOND})(?![0-9])
HAPROXYDATE %{MONTHDAY}/%{MONTH}/%{YEAR}:%{HAPROXYTIME}.%{INT}
HAPROXYHTTP <%{BASE10NUM}>%{SYSLOGTIMESTAMP} %{SYSLOGPROG}: %{IP:client}:%{INT:port} \[%{HAPROXYDATE:accept_date}\] %{NOTSPACE:frontend_name} %{NOTSPACE:backend_name}/%{NOTSPACE:server_name} %{INT:time_request}/%{INT:time_queue}/%{INT:time_backend_connect}/%{INT:time_backend_response}/%{NOTSPACE:time_duration} %{INT:http_status_code} %{NOTSPACE:bytes_read} %{DATA:captured_request_cookie} %{DATA:captured_response_cookie} %{NOTSPACE:termination_state} %{INT:actconn}/%{INT:feconn}/%{INT:beconn}/%{INT:srvconn}/%{NOTSPACE:retries} %{INT:srv_queue}/%{INT:backend_queue} \"(<BADREQ>|(%{WORD:http_verb} (%{URIPROTO:http_proto}://)?(?:%{USER:http_user}(?::[^@]*)?@)?(?:%{URIHOST:http_host})?(?:%{URIPATHPARAM:http_request})?( HTTP/%{NUMBER:http_version})?))?\"
log_format logstash_json '{ "@timestamp": "$time_iso8601", '
'"remote_addr": "$remote_addr", '
'"remote_user": "$remote_user", '
'"body_bytes_sent": "$body_bytes_sent", '
'"request_time": "$request_time", '
'"status": "$status", '
'"request": "$request", '
'"request_method": "$request_method", '
'"http_referrer": "$http_referer", '
'"http_cookie": "$http_cookie", '
@willejs
willejs / gist:7201687
Created October 28, 2013 18:09
logstash elasticsearch template
{
"order": 0,
"template": "logstash-*",
"settings": {
"index.store.compress.stored": "true",
"index.number_of_shards": "20"
},
"mappings": {
"_default_": {
"properties": {
@willejs
willejs / gist:7101360
Created October 22, 2013 14:05
enable RPS ec2
### bind different buffers to different cores using multi queue networking
### http://engineering.pinterest.com/post/53467339970/building-pinterest-in-the-cloud
### reduces effects of irq affinity on EC2/Xen
execute "rps_cpu" do
command "echo f > /sys/class/net/eth0/queues/rx-0/rps_cpus"
user "root"
group "root"
not_if "grep 1 /sys/class/net/eth0/queues/rx-0/rps_cpus"
action :run
@willejs
willejs / gist:6917721
Created October 10, 2013 12:42
get cpu percent per core for a pid usage: ./pid.py <pid-no-here>
#!/usr/bin/python
import os
import sys
core = { 0:float(0.0), 1:float(0.0), 2:float(0.0), 3:float(0.0), 4:float(0.0), 5:float(0.0), 6:float(0.0), 7:float(0.0) }
output = []
for i in os.popen('ps -p {} -L -o pid,tid,psr,pcpu'.format(str(sys.argv[1]))):
output.append(i.rstrip('\n').split())