Skip to content

Instantly share code, notes, and snippets.

View regardfs's full-sized avatar
🎯
Focusing

Leo.feng regardfs

🎯
Focusing
View GitHub Profile
//
// Companion code to https://medium.com/statuscode/pipeline-patterns-in-go-a37bb3a7e61d
//
// To run:
// go get github.com/pkg/errors
// go run -race pipeline_demo.go
//
package main
@regardfs
regardfs / Jenkinsfile.groovy
Created June 4, 2020 08:31 — forked from Faheetah/Jenkinsfile.groovy
Jenkinsfile idiosynchrasies with escaping and quotes
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"
@regardfs
regardfs / main.go
Created May 8, 2019 13:32 — forked from alex-leonhardt/main.go
golang text/template with a map[string]interface{} populated from mixed json data
package main
import (
"encoding/json"
"os"
"reflect"
"text/template"
)
@regardfs
regardfs / Castle.xml
Created December 1, 2018 11:14 — forked from kwmt/Castle.xml
<?xml version="1.0" encoding="UTF-8" ?>
<Data>
<Series>
<id>83462</id>
<Actors>|Nathan Fillion|Stana Katic|Molly C. Quinn|Jon Huertas|Seamus Dever|Tamala Jones|Susan Sullivan|Ruben Santiago-Hudson|Monet Mazur|</Actors>
<Airs_DayOfWeek>Monday</Airs_DayOfWeek>
<Airs_Time>10:00 PM</Airs_Time>
<ContentRating>TV-PG</ContentRating>
<FirstAired>2009-03-09</FirstAired>
<Genre>|Drama|</Genre>
@regardfs
regardfs / grafana-dashboard-exporter
Created November 13, 2017 14:34 — forked from crisidev/grafana-dashboard-exporter
Command to export all grafana 2 dashboard to JSON using curl
KEY=XXXXXXXXXXXX
HOST="https://metrics.crisidev.org"
mkdir -p dashboards && for dash in $(curl -k -H "Authorization: Bearer $KEY" $HOST/api/search\?query\=\& |tr ']' '\n' |cut -d "," -f 5 |grep slug |cut -d\" -f 4); do
curl -k -H "Authorization: Bearer $KEY" $HOST/api/dashboards/db/$dash > dashboards/$dash.json
done
@regardfs
regardfs / cleanup-docker.md
Created June 29, 2017 10:33 — forked from F21/cleanup-docker.md
Commands to clean up docker

Remove dangling images

docker images -qf dangling=true | xargs docker rmi

Remove dangling volumes

docker volume ls -qf dangling=true | xargs -r docker volume rm
/***************************************************************************************************
* Copyright (c) 2015 Rüdiger Herrmann
* All rights reserved. This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Rüdiger Herrmann - initial API and implementation
**************************************************************************************************/
package com.codeaffine.jgit.example;
@regardfs
regardfs / httpie
Created May 11, 2017 09:37 — forked from adrienbrault/httpie
Snippets to quickly install stuff on centos
#!/bin/bash
sudo yum install -y python-pip
sudo pip install httpie
#
@regardfs
regardfs / dockerinstall_xenial.sh
Created March 30, 2017 15:33 — forked from indykish/dockerinstall_xenial.sh
Install Docker 1.12 on Ubuntu Xenial 16.04.1 x64
# Install Docker on Xenial 16.04.1 x64
# Ref https://docs.docker.com/engine/installation/linux/ubuntulinux/
# No interactive for now.
export DEBIAN_FRONTEND=noninteractive
# Update your APT package index.
sudo apt-get -y update
# Update package information, ensure that APT works with the https method, and that CA certificates are installed.
sudo apt-get -y install apt-transport-https ca-certificates
# Add the new GPG key.
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
@regardfs
regardfs / python-autocomplete-setting.sh
Last active February 17, 2017 08:53
python-autocomplete-setting.sh
#!/usr/bin/env bash
# if you are in python3.X env, you should run
sudo apt-get -y install python3-dev libevent-dev libncurses5-dev
# if you are in python2.x env, then sudo apt-get install python-dev
# install readline
pip install readline
# config $HOME/.bashrc