Skip to content

Instantly share code, notes, and snippets.

View n1mh's full-sized avatar

Diego Martínez Castañeda n1mh

View GitHub Profile
@n1mh
n1mh / sed_doble_substitution.sh
Created May 4, 2017 08:32
sed doble substitution
#!/bin/bash
GCC_INSTLLR="https://raw.githubusercontent.com/gecos-team/gecoscc-installer/development/gecoscc-installer.sh"
GCC_VERSION=`curl -s "$GCC_INSTLLR" | grep 'export GECOSCC_VERSION' | cut -d"'" -f2`
GCC_TMPLATE=`curl -s "$GCC_INSTLLR" | grep 'export TEMPLATES_URL' | cut -d'"' -f2 | sed -e 's/$GECOSCC_VERSION/'"$GCC_VERSION"'/'`
# sed 's/xxx/'"$PWD"'/'
echo "Template -> $GCC_TMPLATE"
@n1mh
n1mh / copying_files_rdp_from_linux.sh
Created October 30, 2017 08:49
Copying files using RDP connection from a linux machine
#!/bin/bash
# I've tried to copy files from linux using vinagre (I like it most for RDP connections)
# but it is simplier that rdesktop.
#
# You just have to connect using the option -r disk:share=local_dir and go to a volume
# called 'share in your_machine' and copy the file
/usr/bin/rdesktop 10.10.10.10 -u admin -d myDomain -r disk:share=/home/n1mh/tmp
// how to get multiple redirections using DOM in Contact Form 7
// mandatory from January 2018. on_send_ok is deprecated.
// wp/wp-content/mytheme/functions.php
add_action( 'wp_footer', 'redireccion_contactform7' );
function redireccion_contactform7() {
?>
<script type="text/javascript">
document.addEventListener( 'wpcf7mailsent', function( event ) {
@n1mh
n1mh / mysql_backup.sh
Last active February 28, 2018 22:15
mysql/mariadb complete backup
#!/bin/bash
OUT="`date +%Y%m%d%H%M%S`-backup-`hostname -f`.sql"
mysqldump -u root -p \
--all-databases \
--routines \
--events \
--triggers \
--single-transaction \
@n1mh
n1mh / set-python3.5-in-stretch.sh
Created June 6, 2018 11:33
Set python 3.5 as default in debian 9 (stretch)
#!/bin/bash
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.5 1
exit 0
#!/bin/bash
URL="https://mynewwebsite.com"
LOG="./`basename $0|cut -d'.' -f1`.log"
SEC="5"
while [ '1' == '1' ] ; do
MD5=` wget -q --no-check-certificate -O - $URL | md5sum`
NOW=`date +%Y%m%dT%H%M%S`
echo "$NOW:$MD5" | tee --append $LOG
@n1mh
n1mh / bash
Last active November 5, 2019 10:07
mozilla firefox latest version .desktop file
$ cat /usr/share/applications/firefox-latest.desktop
[Desktop Entry]
Version=1.0
Name=Firefox Latest
Comment=Browse the World Wide Web
GenericName=Web Browser
Keywords=Internet;WWW;Browser;Web;Explorer
Type=Application
Exec=/home/diego/bin/firefox/firefox %u
Terminal=false
#!/bin/bash
sudo yum update -y
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum --enablerepo=epel install -y iperf iperf3
exit 0
@n1mh
n1mh / cleaning_by_extension.sh
Created July 30, 2023 12:11
cleaning two hard disks filtering by file extensions
#!/bin/bash
TIPOS="txt png jpg swf mkv mp4 avi mov xml mp3 ogg cab bat mpg tib cr2 exe"
DISCOS="5TbWDBlack lacie5tbusbc"
for DISCO in $DISCOS; do
echo "creando directorio final en $DISCO"
mkdir -p /media/diego/$DISCO/final
echo "procesando $DISCO"
for TIPO in $TIPOS ; do
@n1mh
n1mh / pull_all.sh
Last active November 10, 2023 09:53
pull all the git repos
#!/bin/bash
DIRS=`find $HOME/git -name .git -type d`
for DIR in $DIRS ; do
cd $DIR/..
echo "processing `pwd`..."
git checkout master
git pull
done