Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Alex Lopes alexlopes

🏠
Working from home
View GitHub Profile
@alexlopes
alexlopes / lowvol_mac.sh
Created Jun 16, 2020
Mac Os Low Volume - Keep Input Volume Mic under 50 %
View lowvol_mac.sh
# thanks to https://apple.stackexchange.com/a/236425/379437
#!/bin/bash
while true ; do
while (( `osascript -e "input volume of (get volume settings)"` > 50 )); do
osascript -e "set volume input volume (input volume of (get volume settings) - 2)";
sleep 0.01;
done;
sleep 1;
done;
@alexlopes
alexlopes / autoupdate_ff.sh
Created Apr 8, 2020
Autoupdate Firefox -
View autoupdate_ff.sh
#!/bin/sh
# an external $FF_VERSION is required
wget https://download-installer.cdn.mozilla.net/pub/firefox/releases/${FF_VERSION}/linux-i686/pt-BR/firefox-${FF_VERSION}.tar.bz2 -O /tmp/firefox.tar.bz2 && tar -xvjf /tmp/firefox.tar.bz2
rm -Rf /usr/lib/firefox
cp -r firefox/ /usr/lib
@alexlopes
alexlopes / github_gpg_config.md
Created Mar 25, 2020
Github + GPG + Custom gitconfig
View github_gpg_config.md

Github + GPG + Custom gitconfig

Add includeIf directive into original .gitconfig

In the end of your original .gitconfig add includeIf with the directory where your .gitconfig-B will be applied:

# ref https://dzone.com/articles/how-to-use-gitconfigs-includeif
# when gitdir matchs, then use .gitconfig-B
View freedom.md

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 {} \;
View elk_tricks.md

Delete Index

curl -u user:pass -X DELETE "localhost:9200/twitter?pretty"
@alexlopes
alexlopes / test_lowercased.py
Created Aug 8, 2019
Pyhon Test messages with all chars lowercased
View test_lowercased.py
import ast
import logging
import sys
import unittest
from io import BytesIO
class TestFormatterMessagesOutputs(unittest.TestCase):
def setUp(self):
logging.basicConfig( level=logging.INFO)
View sql.md
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 Feb 12, 2019 — forked from dopiaza/slackpost
Post a message to a Slack channel
View slackpost
#!/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 / pygh.py
Created Dec 5, 2018
Python and GitHub snippets
View pygh.py
if __name__ == '__main__':
pass
You can’t perform that action at this time.