Skip to content

Instantly share code, notes, and snippets.

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

Alex Lopes alexlopes

🏠
Working from home
View GitHub Profile
@alexlopes
alexlopes / tmux.conf
Created July 7, 2023 13:48 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@alexlopes
alexlopes / read-access.sql
Created December 3, 2020 19:17 — forked from oinopion/read-access.sql
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;
@alexlopes
alexlopes / slackpost
Created February 12, 2019 17:10 — forked from dopiaza/slackpost
Post a message to a Slack channel
#!/bin/bash
# Usage: slackpost <token> <channel> <message>
# Enter the name of your slack host here - the thing that appears in your URL:
# https://slackhost.slack.com/
slackhost=PUT_YOUR_HOST_HERE
token=$1
@alexlopes
alexlopes / open-vm-tools-vmware-ubuntu-sharing.md
Created October 26, 2018 13:34 — forked from darrenpmeyer/open-vm-tools-vmware-ubuntu-sharing.md
open-vm-tools and VMWare Shared Folders for Ubuntu guests

(NB: adapted from this Ask Ubuntu thread -- tested to work with Ubuntu 16 LTS branches and Ubuntu 17.10)

Unlike using VMWare Tools to enable Linux guest capabilities, the open-vm-tools package doesn't auto-mount shared VMWare folders. This can be frustrating in various ways, but there's an easy fix.

TL;DR

Install open-vm-tools and run:

sudo mount -t fuse.vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other
@alexlopes
alexlopes / python_2.7.9_suds_unverified.patch
Created February 28, 2018 18:50 — forked from quasarj/python_2.7.9_suds_unverified.patch
Patch to allow SUDS to work with invalid (or self-signed) SSL certs, on python 2.7.9+
--- /usr/lib/python2.7/site-packages/suds/transport/http.py 2015-06-09 17:40:15.000000000 -0500
+++ http.py 2015-06-09 17:42:05.953929465 -0500
@@ -19,6 +19,7 @@
"""
import urllib2 as u2
+import ssl
import base64
import socket
from suds.transport import *
@alexlopes
alexlopes / ansible_api_playbook.py
Created September 8, 2017 22:07 — forked from viper233/ansible_api_playbook.py
Example using Ansible API 2.0 to run a playbook
#!/usr/bin/env python
# stolen from http://stackoverflow.com/questions/27590039/running-ansible-playbook-using-python-api
import os
import sys
from collections import namedtuple
from ansible.parsing.dataloader import DataLoader
from ansible.vars import VariableManager
from ansible.inventory import Inventory
#!/bin/bash
set -e
GVERSION="1.7"
GFILE="go$GVERSION.linux-amd64.tar.gz"
GOPATH="$HOME/go"
GOROOT="/usr/local/go"
if [ -d $GOROOT ]; then
echo "Installation directories already exist $GOROOT"