Skip to content

Instantly share code, notes, and snippets.

View alincalinciuc's full-sized avatar
🐧

Alin CALINCIUC alincalinciuc

🐧
View GitHub Profile
@alincalinciuc
alincalinciuc / del_empty_log_streams.py
Created January 27, 2023 13:20 — forked from shouptech/del_empty_log_streams.py
Delete empty log streams from AWS CloudWatch Logs
#!/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.
"""
///// 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]\
@alincalinciuc
alincalinciuc / copy-ssm-parameters
Created March 12, 2021 08:40 — forked from mvanholsteijn/copy-ssm-parameters
script to copy all SSM parameter store parameters to disk
#!/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,
@alincalinciuc
alincalinciuc / template.yml
Created September 22, 2020 09:24 — forked from mcasperson/template.yml
Empty CloudFormation Template
AWSTemplateFormatVersion: '2010-09-09'
Description: 'CloudFormation exports'
Conditions:
HasNot: !Equals [ 'true', 'false' ]
# dummy (null) resource, never created
Resources:
NullResource:
Type: 'Custom::NullResource'
@alincalinciuc
alincalinciuc / MinHeap_and_MaxHeap.py
Created June 19, 2020 12:28 — forked from jovianlin/MinHeap_and_MaxHeap.py
Python3 MinHeap and MaxHeap
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)
@alincalinciuc
alincalinciuc / postgres_queries_and_commands.sql
Created January 7, 2019 08:46 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- 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%'
@alincalinciuc
alincalinciuc / jenkins_docker.md
Created December 19, 2018 09:26 — forked from AjeetK/jenkins_docker.md
Adding jenkins User To Docker Group
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
@alincalinciuc
alincalinciuc / runCommandAllDockers.sh
Last active May 25, 2018 11:38 — forked from timhodson/runCommandAllDockers.sh
Run a command on all docker containers
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
@alincalinciuc
alincalinciuc / zimbra-backup-emails.sh
Created March 30, 2018 13:20 — forked from filippo/zimbra-backup-emails.sh
How to backup and restore emails of a specific account on zimbra
# 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
#!/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