Skip to content

Instantly share code, notes, and snippets.

View ataliba's full-sized avatar
🎯
Focusing

cybernetus@xda ataliba

🎯
Focusing
View GitHub Profile
@ataliba
ataliba / gpuf.sh
Created December 4, 2012 00:31
gpuf
gpuf () {
# git pull -f $1
remote=${1:?"need remote to force pull from"}
current_branch=$(git symbolic-ref -q HEAD)
current_branch=${current_branch##refs/heads/}
current_branch=${current_branch:-HEAD}
if [ $current_branch = 'HEAD' ] ; then
echo
echo "On a detached head. Exiting..."
@ataliba
ataliba / exim_mailqueue.sh
Created November 18, 2012 01:15
Exim Mailqueue edited
#!/bin/sh
###############################################
#
# Nagios script to check Exim mail queue status
#
# Copyright 2007, 2008 Ian Yates
#
# NOTE: Depending on your config, the nagios user will probably be
# needed to be added to the exim group for this script to function correctly
#
@ataliba
ataliba / migra-sqlite.txt
Created October 16, 2012 20:03
Migrating sqlite2 to sqlite3
sqlite2 /path/to/mysqlite2.db .dump > backupfile
sqlite3 /path/to/mynewsqlite3.db < backupfile
@ataliba
ataliba / internet_connection.sh
Created September 22, 2012 00:43
Checking Internet Connection with wget
#!/bin/bash
HOST=$1
WGET="/usr/bin/wget"
$WGET -q --tries=10 --timeout=5 $HOST
RESULT=$?
if [[ $RESULT -eq 0 ]]; then
echo "Connection made successfully to $HOST"
@ataliba
ataliba / getmail.py
Created August 30, 2012 02:02
Code to get e-mails in a pop3 server and process then
#!/bin/env python
import poplib
from email import parser
import email
import os
import sys
import string
import re
@ataliba
ataliba / zzservices.sh
Created May 22, 2012 20:38
zzservices - small function to search services on /etc/services
zzservices()
{
grep ^$1 /etc/services
}
@ataliba
ataliba / recursividade.sh
Created May 21, 2012 14:04
Recursividade ( vi este em um comentário e resolvi traduzir )
# Para entender a recursividade veja o final deste arquivo
No final do arquivo :
# Para entender a recursividade veja o início deste arquivo
@ataliba
ataliba / zzinverte.sh
Created May 1, 2012 16:13
Somente para histórico - zzinverte - inverte uma string ( faz o mesmo que a zzvira, que eu não conhecia )
# ----------------------------------------------------------------------------
# Inverte a string passada como parâmetro para o comando
# Uso: zzinverte
# Ex.: zzinverte string
#
# Autor: Ataliba Teixeira, www.ataliba.eti.br
# Desde: 2012-04-30
# Versão: 1
# Licença: GPL
# ----------------------------------------------------------------------------
@ataliba
ataliba / gist:2399072
Created April 16, 2012 14:12
Good code to limit logins of users on FreeBSD ( http://forums.freebsd.org/showthread.php?t=23683 )
#include <iostream>
#include <string>
using namespace std;
string Exec(const char *cmd);
void ReplaceAll(string& str, const string& from, const string& to);
int main(int argc, char **argv, char **envp) {
string whoami, users;
@ataliba
ataliba / warning-remote-host
Created April 16, 2012 02:17
Warning: Remote Host Identification Has Changed error and solution
Hello,
this a simple solution for this problem. If you want to access a host with your ssh and receive this error :
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!