Skip to content

Instantly share code, notes, and snippets.

Avatar

Feron Valentin valferon

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am valferon on github.
  • I am valferon (https://keybase.io/valferon) on keybase.
  • I have a public key ASBdGcB2Y8nAhBc8N4liQuIhuldF7AzVnoojR2-es5hCFAo

To claim this, I am signing this object:

@valferon
valferon / check_aws_ri.py
Created Oct 14, 2019
AWS Reserved Instances by nornalized units to know how many you have total and how many you have reserved
View check_aws_ri.py
#!/usr/bin/python
import argparse
import logging
from pprint import pformat
import boto3
logging.basicConfig(level="INFO")
logger = logging.getLogger('ec2-check-normalized-units')
@valferon
valferon / github_repo.py
Created Dec 14, 2018 — forked from toast38coza/github_repo.py
An Ansible module for managing github repos
View github_repo.py
#!/usr/bin/python
DOCUMENTATION = '''
---
module: github_repo
short_description: Manage your repos on Github
'''
EXAMPLES = '''
- name: Create a github Repo
@valferon
valferon / postgres_manager.py
Created Mar 29, 2018
Python script to take care of postgres backup and restore of data
View postgres_manager.py
#!/usr/bin/python3
import argparse
import logging
import subprocess
import os
import tempfile
from tempfile import mkstemp
import configparser
import gzip
@valferon
valferon / logstash.conf
Last active Oct 31, 2017
Logstash ruby filter to truncate messages that are too long to make it to elasticsearch
View logstash.conf
filter {
ruby {
code => "event.set('message_size', event.get('message').bytesize) if event.get('message')"
}
ruby {
code => "
if (event.get('message_size'))
event.set('message', event.get('message')[0..9999]) if event.get('message_size') > 32000
event.tag 'long message' if event.get('message_size') > 32000
end
View nginx_dns_reload.py
#!/usr/bin/python
import logging
import os
import os.path
import socket
import simplejson as json
import subprocess
#
##