Skip to content

Instantly share code, notes, and snippets.

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

Ícaro M. Bichir IcaroBichir

🏠
Working from home
View GitHub Profile
cat $filename | awk '{print $1}' | sort | uniq -c | awk '{ print $2 " " $1 }' > records_$filename
@IcaroBichir
IcaroBichir / gist:87e697ba3823da9d5b4c3818e4d00ee5
Created February 9, 2018 18:43
device configuration (on/off)
$ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Dell Dell Universal Receiver id=11 [slave pointer (2)]
⎜ ↳ DELL0740:00 06CB:7E7E Touchpad id=14 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=19 [slave pointer (2)]
⎜ ↳ Raydium Corporation Raydium Touch System id=13 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
@IcaroBichir
IcaroBichir / nginx.conf
Created April 14, 2016 19:36
SSL and TLS configurations for nginx
##
# SSL and TLS CONFIGURATION
##
ssl_protocols TLSv1.1 TLSv1.2;
ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES128-SHA:AES128-SHA256:AES256-SHA:AES256-SHA256:AES256-GCM-SHA384:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
@IcaroBichir
IcaroBichir / docker_functions
Created April 6, 2016 19:33
Add this functions on your bash_profile to clean containers and images
function docker_clean_containers() {
docker ps -a | awk '{print $1}' | grep -v CONTAINER | while read container_id; do
docker kill ${container_id}
docker rm ${container_id}
done
}
function docker_clean_images() {
docker images | awk '{print $3}' | grep -v IMAGE | while read container_image; do
docker rmi ${container_image}
@IcaroBichir
IcaroBichir / gist:9442b2a94504079f4dbf
Created March 4, 2016 19:57 — forked from kjoconnor/gist:1007303
Logstash Agent init script
#! /bin/sh
#
# Logstash Start/Stop logstash
#
# chkconfig: 345 99 99
# description: Logstash
# processname: logstash
logstash_bin="java -Djava.net.preferIPv4Stack=true -jar /opt/logstash/logstash-1.0.11pre-monolithic.jar"
logstash_log="/opt/logstash/logstash-agent.log"
@IcaroBichir
IcaroBichir / monit-ui.conf
Created March 1, 2016 17:40
nginx configuration file for monit user interface
server {
listen 80;
server_name monit.yourdomain.net;
return 301 https://monit.yourdomain.net$request_uri;
}
server {
listen 443 ssl;
server_name monit.yourdomain.net;
@IcaroBichir
IcaroBichir / monitrc
Last active March 2, 2016 01:11
Monit configuration for check nginx and tomcat on CentOS servers and send alerts to AWS SES.
set daemon 30
set logfile syslog
set idfile /var/.monit.id
####### MAIL CONF ######
set mailserver email-smtp.us-east-1.amazonaws.com port 465
username "***************"
password "***************"
using SSLV3 with timeout 30 seconds
@IcaroBichir
IcaroBichir / files-and-directory.sh
Created October 28, 2015 11:41
Script to restore cassandra backuped files from snapshot directory.
#! /bin/bash -ex
sudo find /home/ubuntu/backup-000/oldCluster -type d -exec chmod 755 {} +
sudo find /home/ubuntu/backup-000/oldCluster -type f -exec chmod 644 {} +
sudo chown -R cassandra:cassandra /home/ubuntu/backup-000/oldCluster
sudo rm /var/lib/cassandra/commitlog/*.log
sudo rm -rf /var/lib/cassandra/data/system/*
sudo rm -rf /var/lib/cassandra/data/system_traces/*
@IcaroBichir
IcaroBichir / bashrc
Last active June 16, 2016 13:32
.bash_profile or .bashrc
#!/bin/bash
alias ll='ls -GFlaht'
source ~/.git-completion.bash
source ~/.git-prompt.sh
alias gits='git status'
MAGENTA="\[\033[0;35m\]"
YELLOW="\[\033[0;33m\]"
BLUE="\[\033[34m\]"
@IcaroBichir
IcaroBichir / docker_services-validation
Last active March 2, 2016 01:13
Validation for Docker Services Startup
#!/bin/bash
#################################################
# Right now we are assuming you have already #
# installed docker within your machine and your #
# current user belongs to docker system group #
#################################################
#################
# ELASTICSEARCH #