Skip to content

Instantly share code, notes, and snippets.

@jubel-han
jubel-han / redis_key_sizes.sh
Created March 27, 2017 08:52 — forked from epicserve/redis_key_sizes.sh
A simple script to print the size of all your Redis keys.
#!/usr/bin/env bash
# This script prints out all of your Redis keys and their size in a human readable format
# Copyright 2013 Brent O'Connor
# License: http://www.apache.org/licenses/LICENSE-2.0
human_size() {
awk -v sum="$1" ' BEGIN {hum[1024^3]="Gb"; hum[1024^2]="Mb"; hum[1024]="Kb"; for (x=1024^3; x>=1024; x/=1024) { if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break; } } if (sum<1024) print "1kb"; } '
}
@jubel-han
jubel-han / di-xquartz.sh
Created February 15, 2017 06:48
Installation or update xquartz on OS X
#!/bin/bash -f
# Download and install (or update) Xquartz
APP_PATH='/Applications/Utilities/XQuartz.app'
UPDATES_URL='http://xquartz.macosforge.org/downloads/sparkle/release.xml'
DOWNLOAD_ACTUAL=`curl -sL "$UPDATES_URL" | tr '"' '\012' | egrep '^http.*\.dmg' | head -1`
REMOTE_VERSION=`curl -sL "$UPDATES_URL" | awk -F'"' '/sparkle:version=/{print $4}' | head -1`
@jubel-han
jubel-han / Vagrantfile
Last active January 8, 2017 16:53
This is a alternative solution with start the docker socks on MacOS for Jetbrains docker integrate "Docker for Mac".
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.provider "docker" do |d|
d.vagrant_machine = 'docker-socks'
d.force_host_vm = false
d.has_ssh = false
d.image = "bobrik/socat"
d.name = 'docker-socks'
d.ports = ['127.0.0.1:2376:2375']
@jubel-han
jubel-han / Jenkinsfile
Created December 4, 2016 13:50 — forked from chinshr/Jenkinsfile
Best of Jenkinsfile, a collection of useful workflow scripts ready to be copied into your Jenkinsfile on a per use basis.
#!groovy
# Best of Jenkinsfile
# `Jenkinsfile` is a groovy script DSL for defining CI/CD workflows for Jenkins
node {
}
@jubel-han
jubel-han / pipeline_builder_slack_notify.groovy
Last active January 20, 2022 03:12
jenkins build pipeline example with slack notify
node {
try {
notifyBuild('STARTED')
stage('Prepare code') {
gitCheckThatOut('branch', 'repo URL')
}
stage('Testing') {
echo 'Testing'
@jubel-han
jubel-han / gist:4ac67206198a13211b5a9516016cbab8
Created November 23, 2016 14:50 — forked from daicham/gist:1955543
Print the methods of Jenkins inner object on script console
//all job name
jenkins.model.Jenkins.instance.items.each {
println "Job: ${it.name}"
}
//method list of Jenkins instance
jenkins.model.Jenkins.instance.class.methods.each {
println "Jenkins method: ${it.name}"
}
@jubel-han
jubel-han / ciSeedJob.groovy
Created November 4, 2016 03:34 — forked from marcelbirkner/ciSeedJob.groovy
Jenkins Job DSL Seed Job for Continuous Integration Jobs
import groovy.sql.Sql
import java.util.Date
import java.text.SimpleDateFormat
/*
* THIS IS AN EXAMPLE SNIPPET. FOR MORE DETAILS SEE THE FOLLOWING BLOG ARTICLE:
* https://blog.codecentric.de/en/?p=30502
*
* This Jenkins Job DSL Groovy Script creates Continuous Integration (CI) Jobs
* for all Maven & Ant projects that exist on a GitLab Server.
@jubel-han
jubel-han / locust-wrapper.py
Created August 16, 2016 09:55 — forked from wiebren/locust-wrapper.py
Locust MonKit wrapper for Jenkins
import argparse
import subprocess
import sys
import re
from collections import defaultdict
from lxml import etree
report = ["Min", "Avg", "Median", "95%", "99%"]
@jubel-han
jubel-han / Vagrantfile.example
Created May 21, 2016 04:08
Vagrantfile.example
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "ylmaster" do |ylmaster|
config.vm.provider :virtualbox do |vb|
@jubel-han
jubel-han / migrate-redis.py
Last active September 5, 2016 07:43 — forked from thomasst/migrate-redis.py
Migrate Redis data on Amazon ElastiCache
"""
Copies all keys from the source Redis host to the destination Redis host.
Useful to migrate Redis instances where commands like SLAVEOF and MIGRATE are
restricted (e.g. on Amazon ElastiCache).
The script scans through the keyspace of the given database number and uses
a pipeline of DUMP and RESTORE commands to migrate the keys.
Requires Redis 2.8.0 or higher.