Skip to content

Instantly share code, notes, and snippets.

View samirfor's full-sized avatar

Samir C. Costa samirfor

  • Brazil
  • 15:35 (UTC -03:00)
View GitHub Profile
<VirtualHost *:80>
ServerName hom.sgps.fortaleza.ce.gov.br
DocumentRoot /var/www/meusistema
ErrorLog ${APACHE_LOG_DIR}/meusistema_error.log
CustomLog ${APACHE_LOG_DIR}/meusistema_access.log combined
<Directory /var/www/meusistema/public>
DirectoryIndex index.html index.php
Options -Indexes
AllowOverride All
@samirfor
samirfor / rsync_all_media_mounted.sh
Last active December 19, 2016 17:21
Rsync incremental + beep when finished
#!/bin/bash
SOURCE_DIR="$1"
if [ "${SOURCE_DIR}x" = "x" ]; then
SOURCE_DIR="/home/${USER}/Downloads/Fortaleza2040/" # the last / is important!
fi
[ ! -d "${SOURCE_DIR}" ] && echo "${SOURCE_DIR} is not a dir. Usage: $0 <dir>" && exit 2
for mount_point in $(find /media/${USER}/ -maxdepth 1 -type d); do
@samirfor
samirfor / gist:cd9da6be89e8ba9faef4462f0d13004a
Created December 19, 2016 19:52
format_fat32_all_devs.sh
#!/bin/bash
[ "${USER}" != "root" ] && echo "Rode como root"; exit 2
for dev in $(find /dev/ -maxdepth 1 -name "sd*1" ! -name "*sda1"); do
mkfs.fat -F32 -v -I "$dev" &
done
wait # Expects all jobs finished second plan.
@samirfor
samirfor / play_when_process_done.sh
Created February 1, 2017 16:51
Bash script to play a song when a process ends.
#!/bin/bash
# Bash script to play a song when a process ends.
# License MIT <https://opensource.org/licenses/MIT>
# Author: @samirfor
PID=$1
SONGFILE=$2
if [ "${PID}x" = "x" ] || [ ! -r "${SONGFILE}" ]; then
@samirfor
samirfor / ssh-tor.sh
Last active February 23, 2017 14:47
Tunnel SSH connection through Tor network
#!/bin/bash
#
# install:
#
# echo "alias ssh-tor=/path/to/this/script/ssh-tor.sh" >> ~/.bash_aliases
# . ~/.bash_aliases
#
# usage:
# - start Tor Browser
@samirfor
samirfor / bareos_ports_templates.xml
Created March 10, 2017 17:29
Zabbix 3.0 Bareos Ports Template (Client, Storage, Director)
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>3.0</version>
<date>2017-03-10T17:15:52Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<templates>
>>> import spotipy
>>> import sys
>>> import pprint
>>>
>>> if len(sys.argv) > 1:
... urn = sys.argv[1]
... else:
... urn = 'spotify:artist:3jOstUTkEu2JkjvRdBA5Gu'
...
>>> sp = spotipy.Spotify()
@samirfor
samirfor / mongo_backup.sh
Last active May 10, 2017 13:17 — forked from sheharyarn/mongo_backup.sh
Mongodump All Databases Shell Script for Cronjob
#!/bin/sh
set -e
HOST_NAME="$(hostname)"
MONGO_HOST="127.0.0.1"
MONGO_PORT=27017
MONGO_USER="admin"
MONGO_PASS="password"
MONGO_AUTHDB="admin"
@samirfor
samirfor / send-mail.sh
Created August 7, 2017 15:01
Send a e-mail using mailx software
#!/bin/bash
EMAIL_SUBJECT="Desligamento agendado `date +%d/%m/%Y`"
FROM_EMAIL_ADDRESS="fela@chupa.br"
FROM_EMAIL_PASSWORD="password"
FRIENDLY_NAME="Fela de Tal"
STMP_HOST="mail.chupa.br:587"
echo -e "Olá, os servidores serão \
desligados dentro de 30 minutos. \