Skip to content

Instantly share code, notes, and snippets.

@taavituisk
taavituisk / tcp-pinger.sh
Created February 13, 2020 16:26
tcp ping script using netcat
#!/bin/bash
pinghost="${1}"
pingport="${2}"
pingtimeout=10
pingcmd="nc -w ${pingtimeout} ${pinghost} ${pingport}"
pingret=0
echo "$(date -Iseconds) - connecting to ${pinghost} ${pingport}"

Keybase proof

I hereby claim:

  • I am taavituisk on github.
  • I am taavituisk (https://keybase.io/taavituisk) on keybase.
  • I have a public key ASDIzMJcBKTfdtwwXBOF7iiKS-pmpxxQjU89M5nfb1XXfAo

To claim this, I am signing this object:

@taavituisk
taavituisk / pinger.sh
Created September 7, 2018 11:21
network monitoring script
#!/bin/bash
pinghost="${1}"
pingcmd="-n -q -c 3 ${pinghost}"
pingret=0
echo "$(date -Iseconds) - going to go ping against ${pinghost}"
while true; do
while [[ ${pingret} = 0 ]]; do
#!/bin/bash -e
# Setup a Root CA in vault
# Generate and sign an Intermediate cert
#
# Requires:
# * A running vault server already initialzed and unsealed
# * Environment variable VAULT_TOKEN is set
# * vault cli (https://www.vaultproject.io)
# * httpie (https://github.com/jkbrzt/httpie)
@taavituisk
taavituisk / sshtunnel.sh
Last active May 28, 2018 11:03
ssh tunnel script with retry velocity checks.
#!/bin/bash
SSHKEY='/home/someone/.ssh/id_rsa'
REMOTEIP='xxx.xxx.xxx.xxx'
USER='user'
GWHOST='yyy.yyy.yyy.yyy'
RETRIES=200
# Stop everything on interrupt.
trap ctrlc INT
text
skipx
install
url --url http://mirror.raystedman.net/centos/6/os/x86_64/
repo --name=updates --baseurl=http://mirror.raystedman.net/centos/6/updates/x86_64/
lang en_US.UTF-8
keyboard us
rootpw s0m3password
firewall --disable
authconfig --enableshadow --passalgo=sha512
@taavituisk
taavituisk / setup.yml
Last active February 20, 2017 10:39
ansible test
- hosts: all
gather_facts: false # As Python is not yet installed, we cannot gather host facts
pre_tasks:
- name: making sure python2 and aptitude is there
become: yes
raw: "apt-get -y -q install python2.7 aptitude"
- name: run setup module to gather facts
setup:
@taavituisk
taavituisk / upload.php
Created September 13, 2016 20:21
s3 uploader in php
<?php
require 'vendor/autoload.php';
# use your awscli profile name here
$profile = 'your profile';
$bucket = 'your bucket';
$keyname = 'testfile.txt';
$filename = './testfile.txt';
$localfile = fopen(realpath($filename), 'r');
@taavituisk
taavituisk / vmimport.json
Created January 6, 2016 14:53
aws image import role
{
"Version":"2012-10-17",
"Statement":[
{
"Effect":"Allow",
"Action":[
"s3:ListBucket",
"s3:GetBucketLocation"
],
"Resource":[
@taavituisk
taavituisk / knife.rb
Last active August 29, 2015 14:17
knife config file for multiple environments.
current_orgenv = ENV['CHEF_ORG'] + ENV['CHEF_MYENV']
current_dir = File.dirname(__FILE__)
user = ENV['CHEF_USER'] || ENV['USER']
node_name user
client_key "#{ENV['HOME']}/.chef/#{current_orgenv}_#{user}.pem"
validation_client_name "#{ENV['CHEF_ORG']}-validator"
validation_key "#{ENV['HOME']}/.chef/#{current_orgenv}_validator.pem"
chef_server_url "#{ENV['CHEF_SERVER']}"
syntax_check_cache_path "#{ENV['HOME']}/.chef/syntax_check_cache"