Skip to content

Instantly share code, notes, and snippets.

# delete the line where is 'TO DELETE'
sed -i '/TO DELETE/ d' file.txt
@linki
linki / rm_images.sh
Last active August 29, 2015 14:16
remove superflous images
#!/usr/bin/env bash
images=( $(docker images | awk '{ print $1 }' | sort | uniq -c | awk '{print $2}' ) )
for i in "${images[@]}"
do
echo "removing superflous images for" $i
docker images | grep "$i" | tail -n +2 | grep -v latest | awk '{print $1 ":" $2}' | xargs docker rmi
done
@linki
linki / -
Last active August 29, 2015 14:15
Delayed::Job.all.each do |d| d.locked_by = nil; d.locked_at = nil; d.run_at = Time.now; d.attempts = 0; d.save! end
@linki
linki / -
Created February 21, 2015 18:26
sudo coreos-cloudinit -from-file /var/lib/coreos-install/user_data
# Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
# You can use `rake secret` to generate a secure secret key.
# Make sure the secrets in this file are kept private
@linki
linki / -
Created February 13, 2015 12:57
irb(main):001:0> Redmine::AccessControl.available_project_modules
=> [:work_package_tracking, :time_tracking, :news, :wiki, :repository, :boards, :calendar, :timelines, :documents, :meetings, :costs_module, :backlogs, :activity]
eb printenv | \
tail -n +2 | \
sed "s/ //" | \
sed "s/ = /\"=\"/" | \
sed "s/\(.*\)/\"\1\"/" | \
grep -v "AWS.*KEY" | \
grep -v "PARAM.*" | \
sort \
> environment.txt
@linki
linki / jenkins.service
Last active August 29, 2015 14:14
run a docker based jenkins slave on our ci (deprecated)
[Unit]
Description=Docker Jenkins Slave
After=docker.service
[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill jenkins-slave
ExecStartPre=-/usr/bin/docker rm jenkins-slave
ExecStartPre=/usr/bin/docker pull csanchez/jenkins-swarm-slave:latest
ExecStart=/usr/bin/docker run --name jenkins-slave -h "coreos-01" csanchez/jenkins-swarm-slave:latest -master http://10.110.2.50/ -username linki -password ef8da0e3dbfe441d89b7f62b3d4f11bb -executors 5 -labels "docker coreos" -fsroot /home/jenkins-slave/ -name "coreos-01"
@linki
linki / last_container.sh
Last active August 29, 2015 14:14
enter current container
docker exec -it `docker ps -lq` bash
@linki
linki / extract.rb
Last active August 29, 2015 14:14
extract at
require 'openssl'
require 'json/jwt'
require 'pp'
token = ARGV[0]
private_key = OpenSSL::PKey::RSA.new(ENV.fetch('CONCIERGE_PRIVATE_KEY').gsub('.', "\n"))
token = JSON::JWT.decode(token, private_key)
pp token.to_hash