Skip to content

Instantly share code, notes, and snippets.

View ksandrmatveyev's full-sized avatar

Aliaksandr Matveyeu ksandrmatveyev

  • Gomel
View GitHub Profile
@ksandrmatveyev
ksandrmatveyev / SlackNotificationOctopusDeploy.ps1
Created January 17, 2019 11:06 — forked from jiimaho/SlackNotificationOctopusDeploy.ps1
Octopus script template for slack notifiation with release notes and deployment link
function Slack-Rich-Notification ($notification)
{
$payload = @{
channel = $OctopusParameters['Channel']
username = $OctopusParameters['Username'];
icon_url = $OctopusParameters['IconUrl'];
attachments = @(
@{
fallback = $notification["fallback"];
color = $notification["color"];
@ksandrmatveyev
ksandrmatveyev / grafana-dashboard-exporter
Last active June 27, 2022 07:34 — forked from crisidev/grafana-dashboard-exporter
Command to export all grafana 2 dashboard to JSON using curl
#!/bin/bash
#
# add the "-x" option to the shebang line if you want a more verbose output
#
# set some colors for status OK, FAIL and titles
SETCOLOR_SUCCESS="echo -en \\033[0;32m"
SETCOLOR_FAILURE="echo -en \\033[1;31m"
SETCOLOR_NORMAL="echo -en \\033[0;39m"
SETCOLOR_TITLE_PURPLE="echo -en \\033[0;35m" # purple
import org.sonatype.nexus.repository.storage.StorageFacet;
import org.sonatype.nexus.repository.storage.Query;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
def fmt = DateTimeFormat.forPattern('yyyy-MM-dd HH:mm:ss');
// Get a repository
def repo = repository.repositoryManager.get('nuget-releases');
// Get a database transaction
def tx = repo.facet(StorageFacet).txSupplier().get();
@ksandrmatveyev
ksandrmatveyev / purge_nexus_v3_releases.groovy
Created October 20, 2017 13:53 — forked from tgagor/purge_nexus_v3_releases.groovy
Script that can be used to purge nexus v3 releases
import org.sonatype.nexus.repository.storage.StorageFacet;
import org.sonatype.nexus.repository.storage.Query;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
def fmt = DateTimeFormat.forPattern('yyyy-MM-dd HH:mm:ss');
[
'maven-releases',
'other-releases'
].each { reponame ->
@ksandrmatveyev
ksandrmatveyev / mysql-docker.sh
Created July 6, 2017 13:31 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE