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 / zzmeuip.sh
Created April 13, 2012 11:47
Função zzmeuip do funcoeszz - não foi adicionada ao repositório pois já existe uma que faz a função dela
#!/bin/sh
# ----------------------------------------------------------------------------
# Mostra o seu ip público.
# Uso: zzmeuip
# Ex.: zzmeuip
#
# Autor: Ataliba Teixeira < ataliba (a) ataliba.eti.br >
# Desde: 2010-12-25
# Versão: 1.0
# Licença: GPL
@ataliba
ataliba / krnpertty.service
Created April 13, 2012 11:49
Update for my tip about the kernel otimization using cgroup
[Unit]
Description=Enable creation of task groups per TTY
[Service]
Type=oneshot
ExecStart=/bin/mkdir -p -m 0777 /sys/fs/cgroup/cpu/user
[Install]
WantedBy=multi-user.target
@ataliba
ataliba / phttping.php
Created April 13, 2012 12:35
A simple script I create in the past to monitoring my blog/site
<?php
$arquivo = "$HOME/logs/uptime";
$abre = fopen($arquivo,"a+");
$ip = "mysite.com.br";
$comando = "/arpa/af/c/cerebro/bin/commands/httping -c 1 -g http://".$ip;
$saida = shell_exec($comando);
@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)!
@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 / 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 / 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 / zzservices.sh
Created May 22, 2012 20:38
zzservices - small function to search services on /etc/services
zzservices()
{
grep ^$1 /etc/services
}
@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 / 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"