Skip to content

Instantly share code, notes, and snippets.

View shazaum's full-sized avatar
🏠
Working from home

Renato dos Santos shazaum

🏠
Working from home
View GitHub Profile
@dklima
dklima / .bashrc
Last active January 10, 2018 11:42
bash prompt like "pure" theme from zsh (with current git branch)
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
PS1="\n\[\033[94m\]\w\[\033[0m\]\$(parse_git_branch)\[\033[00m\]\n\[\033[1;35m\]❯\[\033[1;33m\] \[\033[0m\]"
export PS1
#
# First Login on PostgreSQL 9.6.4
#
# configuration files on Ubuntu - /etc/postgresql/9.6/main
# configuration files on CentOS - ##
# pg_hba.conf file - add this lines for remote connection
host all all 0.0.0.0/0 md5
host all all ::/0 md5
@oinopion
oinopion / read-access.sql
Created October 5, 2016 13:00
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;
@iMilnb
iMilnb / ec2.py
Created May 27, 2015 12:29
AWS EC2 simple manipulation script using python and boto3
#!/usr/bin/env python
# Simple [boto3](https://github.com/boto/boto3) based EC2 manipulation tool
#
# To start an instance, create a yaml file with the following format:
#
# frankfurt:
# - subnet-azb:
# - type: t2.micro
# image: image-tagname
@KartikTalwar
KartikTalwar / Documentation.md
Last active May 9, 2024 12:59
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@jfinstrom
jfinstrom / asterisk.py
Last active July 14, 2021 14:37
Example of using the Asterisk Manager API in python...
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# asterisk.py
#
# Copyright 2014 James Finstrom<jfinstrom at gmail>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or