Skip to content

Instantly share code, notes, and snippets.

View guillaume-martin's full-sized avatar
:octocat:

Guillaume Martin guillaume-martin

:octocat:
View GitHub Profile
@guillaume-martin
guillaume-martin / rds-logs-report
Created January 10, 2022 08:26
A script for automatically downloading log files from an AWS RDS instance and generating a report using pgbadger.
#!/bin/bash
# Downloads all the log files for a selected instance on a given day. Then
# generates a report using pgbadger.
# Requirements:
# - AWS CLI (https://github.com/aws/aws-cli)
# - pgbadger (https://github.com/darold/pgbadger)
# How to use:
# rds-logs-report <instance_id> <date>
@guillaume-martin
guillaume-martin / .tmux.conf
Created January 11, 2018 05:40
configuration file for tmux
# more settings: https://pastebin.com/4ZCTcf7m
# set prefix to Ctrl-a
set-option -g prefix C-a
unbind-key C-a
bind-key C-a send-prefix
# use Alt-arraw keys to switch panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
@guillaume-martin
guillaume-martin / pandas-read-sql-from-psql.py
Created July 28, 2017 07:09
Create a pandas dataframe from an sql query to a remote psql database
import pandas as pd
from sqlalchemy import create_engine
driver = "postgresql"
server = ""
port = "5432"
database = ""
uid = ""
pwd = ""
@guillaume-martin
guillaume-martin / .bash_aliases
Created February 12, 2015 07:57
show git branch in bash prompt
# customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset
# modified from http://stackoverflow.com/a/2728344
# iterate through all characters of a string
# returns true if all characters are chinese and false otherwise
def is_chinese(str)
result = nil
unless str.nil?
# put utf of each character in array
list_of_chars = str.unpack("U*")
# control if each character is a chinese character
# breaks if find a non chinese character
@guillaume-martin
guillaume-martin / .gitignore
Created October 1, 2014 04:56
augmented .gitignore file
# Ignore bundler config.
/.bundle
# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp