DOCKER_SOCKET=/var/run/docker.sock
DOCKER_GROUP=docker
JENKINS_USER=jenkins
if [ -S ${DOCKER_SOCKET} ]; then
DOCKER_GID=$(stat -c '%g' ${DOCKER_SOCKET})
sudo groupadd -for -g ${DOCKER_GID} ${DOCKER_GROUP}
sudo usermod -aG ${DOCKER_GROUP} ${JENKINS_USER}
fi
This file contains 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
#!/usr/bin/env python | |
""" | |
This script deletes empty log streams from cloudwatch log groups. | |
Your shell should be configured for connecting to the AWS API. This can be done | |
with the CLI command `aws configure`. | |
This script requires Python 3.6 or newer, and you must have boto3 installed. | |
""" |
This file contains 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
///// TODO : Replace <<LAN_INTERFACE>> with internal bridge or lan interface, replace <<<PPPOE_DIGI_INTERFACE>>> with the pppoe-digi interface | |
/ipv6 nd | |
set [ find default=yes ] disabled=yes | |
add advertise-dns=yes interface=<<LAN_INTERFACE>> | |
/ipv6 dhcp-client | |
add add-default-route=yes interface=<<<PPPOE_DIGI_INTERFACE>>> pool-name=pool6 request=address,prefix script=":del\ | |
ay 5s;\ | |
\n/ipv6 address remove [find advertise=yes]\ |
This file contains 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
#!/usr/bin/env python | |
# | |
# copy all SSM parameter store parameters to disk | |
# | |
import os, sys, argparse, boto3 | |
parser = argparse.ArgumentParser(description='copy all parameter values to local') | |
parser.add_argument("--path", dest="path", required=True, | |
help="to copy the keys from", metavar="STRING") | |
parser.add_argument("--directory", dest="directory", required=True, |
This file contains 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
AWSTemplateFormatVersion: '2010-09-09' | |
Description: 'CloudFormation exports' | |
Conditions: | |
HasNot: !Equals [ 'true', 'false' ] | |
# dummy (null) resource, never created | |
Resources: | |
NullResource: | |
Type: 'Custom::NullResource' |
This file contains 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
class MaxHeapObj: | |
def __init__(self,val): self.val = val | |
def __lt__(self,other): return self.val > other.val | |
def __eq__(self,other): return self.val == other.val | |
def __str__(self): return str(self.val) | |
class MinHeap: | |
def __init__(self): self.h = [] | |
def heappush(self,x): heapq.heappush(self.h,x) | |
def heappop(self): return heapq.heappop(self.h) |
This file contains 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
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
This file contains 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
for container in `docker ps -q`; do | |
# show the name of the container | |
docker inspect --format='{{.Name}}' $container; | |
# run the command (date in the case) | |
docker exec -it $container netstat -anpt | grep PORT; | |
done |
This file contains 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
# The command below creates a tgz file with all emails for user@domain.com in .eml format: | |
# execute as root | |
/opt/zimbra/bin/zmmailbox -z -m user@domain.com getRestURL "//?fmt=tgz" > /tmp/account.tgz | |
# You can do the same via a REST URL: | |
wget http://ZIMBRA.SERVER/home/user@domain.com/?fmt=tgz | |
# to restore email: | |
/opt/zimbra/bin/zmmailbox -z -m user@domain.com postRestURL "//?fmt=tgz&resolve=reset" /tmp/account.tgz |
This file contains 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/sh | |
# jstatd - runs the jstat daemon | |
# | |
# chkconfig: - 85 15 | |
# description: Jstatd JVM monitoring | |
# processname: jstatd | |
# pidfile: /var/run/jstatd.pid | |
# Source function library. | |
. /etc/rc.d/init.d/functions |
NewerOlder