Skip to content

Instantly share code, notes, and snippets.

View siavashs's full-sized avatar
🏗️
Under construction...

Siavash Safi siavashs

🏗️
Under construction...
View GitHub Profile
@siavashs
siavashs / fix-helm-status.md
Last active October 19, 2022 17:01
Fix Helm release stuck in a pending status
  1. Get the release from Kubernetes
    $ kubectl get secret sh.helm.release.v1.<release>.v<version> -o yaml > release.yaml
  2. Open the release.yaml file in an editor and copy data.release value (or use Bash skills)
  3. Extract the release payload
    $ echo <release value> | base64 -D | base64 -D | gunzip > release
  4. Open release file and change status from pending-rollback to deployed
@siavashs
siavashs / xhyve-ovpn-nat.sh
Created September 5, 2019 14:05
Script for adding NAT rules for xhyve VMs to subnets behind OpenVPN
#!/bin/sh
subnets="10.1/16"
rules="/tmp/nat.rules"
echo "Clearing nat table..."
sudo pfctl -a com.apple/tun -F nat
echo "Generaring nat rules..."
echo > $rules
@siavashs
siavashs / autopgsqlbackup
Created July 26, 2016 16:55 — forked from matthewlehner/autopgsqlbackup
Auto PostgreSQL backup script.
#!/bin/bash
#
# PostgreSQL Backup Script Ver 1.0
# http://autopgsqlbackup.frozenpc.net
# Copyright (c) 2005 Aaron Axelsen <axelseaa@amadmax.com>
#
# This script is based of the AutoMySQLBackup Script Ver 2.2
# It can be found at http://sourceforge.net/projects/automysqlbackup/
#
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9

Keybase proof

I hereby claim:

  • I am siavashs on github.
  • I am siavashs (https://keybase.io/siavashs) on keybase.
  • I have a public key whose fingerprint is 99B3 7FBE 5F9C B371 31A8 EFE0 1946 A9F5 C369 18B2

To claim this, I am signing this object:

@siavashs
siavashs / nexus.sh
Last active May 31, 2016 12:24
Nexus artifact deployment script
#!/bin/bash
# Author: Siavash Safi <siavash.safi@gmail.com>
# Nexus artifact deployment script
# Original solution from https://support.sonatype.com/hc/en-us/articles/213465818-How-can-I-programatically-upload-an-artifact-into-Nexus-
groupId=`xmlstarlet sel -t -v '//_:project/_:groupId' pom.xml`
artifactId=`xmlstarlet sel -t -v '//_:project/_:artifactId' pom.xml`
version=`xmlstarlet sel -t -v '//_:project/_:version' pom.xml`
packaging=`xmlstarlet sel -t -v '//_:project/_:packaging' pom.xml`
@siavashs
siavashs / gist:798fa9619b91918d4524
Created May 4, 2015 13:51
mysqld_exporter sample output
# HELP http_request_duration_microseconds The HTTP request latencies in microseconds.
# TYPE http_request_duration_microseconds summary
http_request_duration_microseconds{handler="prometheus",quantile="0.5"} 9206.461
http_request_duration_microseconds{handler="prometheus",quantile="0.9"} 11817.503
http_request_duration_microseconds{handler="prometheus",quantile="0.99"} 12880.886
http_request_duration_microseconds_sum{handler="prometheus"} 6.201126414000001e+06
http_request_duration_microseconds_count{handler="prometheus"} 653
# HELP http_request_size_bytes The HTTP request sizes in bytes.
# TYPE http_request_size_bytes summary
http_request_size_bytes{handler="prometheus",quantile="0.5"} 299
@siavashs
siavashs / ip2location-c.spec
Created February 1, 2015 08:12
ip2location C library rpm SPEC
Name: ip2location-c
Version: 7.0.0
Release: 1%{?dist}
Summary: IP2Location C Library
Group: Development/Libraries
License: GPLv3+
URL: http://www.ip2location.com/c.aspx
Source0: http://www.ip2location.com/downloads/%{name}-%{version}.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
@siavashs
siavashs / remote_syslog
Last active August 29, 2015 14:12
remote_syslog2 rc.d script for FreeBSD
#!/bin/sh
#
# PROVIDE: remote_syslog
#
. /etc/rc.subr
name="remote_syslog"
rcvar="${name}_enable"
@siavashs
siavashs / lyrics.rb
Created August 31, 2012 17:50
Ruby script to fetch lyrics from Lyric Wiki
# lyrics.rb: Ruby script to fetch lyrics from Lyric Wiki
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the