This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# packages { ['jq', 'awscli']: ensure => installed } | |
# cat ~/.aws/config | |
# [profile ebs_snapshot] | |
# aws_access_key_id = XXXXXXXXX | |
# region = us-east-1 | |
# output = json | |
# aws_secret_access_key = XXXXXXXXXX | |
export AWS_DEFAULT_PROFILE=ebs_snapshot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Split a flac file in several ones using a cue file. | |
# Prerequisites: sudo apt-get install cuetools shntool flac | |
shnsplit -f *.cue -t "%n-%t" -o "flac flac -s -8 -o %f -" *.flac |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import re | |
import subprocess | |
parser = argparse.ArgumentParser(description='Provides the RTT average and packet loss over N ping commands to a destinatino.') | |
parser.add_argument('hostname', metavar='HOSTNAME', help='IP or hostname to check the rtt and packet loss from') | |
parser.add_argument('-c', '--ping-count', metavar='COUNT', default=5, type=int, help='IP or hostname to check the rtt and packet loss from') | |
args = parser.parse_args() | |
packets_pattern = re.compile(r'\d+ packets transmitted, \d+ received, (\d+)% packet loss') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import subprocess | |
import sys | |
import time | |
global descriptors | |
descriptors = [] | |
debug = 1 | |
packets_pattern = re.compile(r'\d+ packets transmitted, \d+ received, (\d+)% packet loss') | |
rta_pattern = re.compile(r'rtt min/avg/max/mdev = [0-9\.]+/([0-9]+)\.[0-9]+/[0-9\.]+/[0-9\.]+ ms') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ctypes | |
import os | |
def mount(source, target, fs, options=''): | |
ret = ctypes.CDLL('libc.so.6', use_errno=True).mount(source, target, fs, 0, options) | |
if ret < 0: | |
errno = ctypes.get_errno() | |
raise RuntimeError("Error mounting {} ({}) on {} with options '{}': {}". | |
format(source, fs, target, options, os.strerror(errno))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
go func() { | |
signals := make(chan os.Signal, 1) | |
signal.Notify(signals, os.Kill, os.Interrupt) | |
<-signals | |
logger.Println("Initiating shutdown of consumer...") | |
close(closing) | |
}() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/tls" | |
"fmt" | |
"gopkg.in/ldap.v2" | |
"log" | |
) | |
// Of course, this is to give an idea of what should be in those variables, but this should end up in environment variables or flags and should not be stored inside the script! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo lsof -n -F 'Lp'| awk 'BEGIN{pid=0; user=""};{if(match($0, /^p([0-9]*)$/, d)){pid=d[1]} if(match($0, /^L(.*)$/,d)){user=d[1]} if(match($0, /^f(.*)$/)){a[sprintf("%s\tpid: %d",user, pid)]++}} END {for (i in a) print a[i], "\tuser: ", i}' | sort -n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"flag" | |
"io/ioutil" | |
"log" | |
"github.com/gobike/envflag" | |
"github.com/sethvargo/go-fastly" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"encoding/json" | |
"flag" | |
"io/ioutil" | |
"log" | |
"time" |