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 / freedom.md
Created October 24, 2019 14:31
freedom

Change permissions

# This will recursively search your directory tree (starting at dir 'dot') and chmod 755 all directories only.
find . -type d -exec chmod 755 {} \;
#Similarly, the following will chmod all files only (and ignore the directories):
find . -type f -exec chmod 644 {} \;
@alexlopes
alexlopes / elk_tricks.md
Created August 14, 2019 21:42
ELK Tricks

Delete Index

curl -u user:pass -X DELETE "localhost:9200/twitter?pretty"
@alexlopes
alexlopes / test_lowercased.py
Created August 8, 2019 19:33
Pyhon Test messages with all chars lowercased
import ast
import logging
import sys
import unittest
from io import BytesIO
class TestFormatterMessagesOutputs(unittest.TestCase):
def setUp(self):
logging.basicConfig( level=logging.INFO)
@alexlopes
alexlopes / sql.md
Created March 14, 2019 17:39
SQL Tricks
select a.*, b.id from 

(
       select * from (
                       select regexp_substr('TC,HBO,FUT','[^,]+',1,level) element, level as lvl
                       from dual             connect by level <= length(regexp_replace('TC,HBO,FUT','[^,]+')) + 1 
                       )   
       PIVOT ( MAX(element) FOR lvl IN (1,2,3)) mypivot 
) a, something.table b 
@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 / my_graph.md
Created December 18, 2018 14:15
my graph
@alexlopes
alexlopes / pygh.py
Created December 5, 2018 13:15
Python and GitHub snippets
if __name__ == '__main__':
pass
@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 / docker-stackes.yml
Last active September 20, 2018 02:37
Docker Stack
## Elastic Search
version: "3.2"
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.2.4
ports:
- 9600:9200
- 9300:9300
environment:
@alexlopes
alexlopes / windows_bash.md
Last active August 23, 2018 17:37
Windows Bash

sudo apt-get install dirmngr -y

sudo apt-get install sshpass -y