This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SRC=/tmp/wordpress | |
DST=/var/www | |
SITES=( example.com example.org example.net ) | |
for site in ${SITES[@]}; do | |
echo "Upgrading $site" | |
dir="$DST/$site/public_html" | |
bak="$DST/$site/public_html.bak" | |
# backup |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Recover from an Audacity 2.0 crash by reassembling the saved data files | |
#Based on https://gist.github.com/912222 | |
if [ $# != 2 ]; then | |
echo "ERROR: Not enough arguments" | |
echo "$0 [SOURCE PATH] [DESTINATION]" | |
exit 1 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
sub rtrim($) { | |
my $string = shift; | |
$string =~ s/\s+$//; | |
return $string; | |
} | |
@lines=(<>); | |
for (@lines) { | |
s/{if \$(.*?)}/{% if \1 %}/g; | |
s/{elseif \$(.*?)}/{% elif \1 %}/g; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z $1 ]; then | |
echo "Usage: $0 <virtual_machine_name>" | |
exit | |
fi | |
VM=$1 | |
HOMEIMG=/home/$VM | |
OLDDISK=$HOMEIMG/$VM.img |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os, os.path | |
import fileinput | |
files_in_dir = os.listdir('.') | |
for f in files_in_dir: | |
for line in fileinput.input(f, inplace=1): | |
#for line in fileinput.input(f): | |
if line == '<head>\n': | |
print '%s<script language="javascript">if(self.location==top.location)self.location="index.html?%s";</script>' % (line, f) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$zone = 'dnsbl.example.com'; | |
if (isset($_REQUEST['ip'])) { | |
$ip = preg_replace('/[^0-9.]/', '', $_REQUEST['ip']); | |
if(filter_var($ip, FILTER_VALIDATE_IP)) { | |
$fields = explode('.', $ip); | |
$fields = array_reverse($fields); | |
$reverse_ip = implode('.', $fields); | |
$record = $reverse_ip . '.' . $zone; | |
$result = dns_get_record($record, DNS_A); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# $ fab set_hosts update | |
# | |
from fabric.api import run, env, sudo | |
from fabric.contrib.console import confirm | |
env.warn_only = True | |
def set_hosts(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$var = "TEXTO_CODIFICADO_EN_BASE64"; | |
decodifica(base64_decode($var)); | |
function decodifica($text) { | |
$a = $text; | |
$a = preg_replace('/eval\((.*)\);/', '\\1', $a); | |
if (preg_match('/base64_decode/', $a)) { | |
$a = preg_replace('/base64_decode\("(.*)"\)/', '\\1', $a); | |
$a = base64_decode($a); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
NAME=$1 | |
RAM=512 | |
DIR=/var/images | |
virt-install \ | |
--name $NAME \ | |
--ram 512 \ | |
--disk path=$DIR/$NAME.img,size=10 \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .bashrc | |
# Source global definitions | |
if [ -f /etc/bashrc ]; then | |
. /etc/bashrc | |
fi | |
# User specific aliases and functions | |
export GIT_AUTHOR_NAME="Bob Smith" | |
export GIT_AUTHOR_EMAIL="[email protected]" |