Skip to content

Instantly share code, notes, and snippets.

Diego Martínez Castañeda n1mh

Block or report user

Report or block n1mh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View md-test.sh
#!/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 / set-python3.5-in-stretch.sh
Created Jun 6, 2018
Set python 3.5 as default in debian 9 (stretch)
View set-python3.5-in-stretch.sh
#!/bin/bash
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.5 1
exit 0
@n1mh
n1mh / mysql_backup.sh
Last active Feb 28, 2018
mysql/mariadb complete backup
View mysql_backup.sh
#!/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 \
View functions.php
// 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 / copying_files_rdp_from_linux.sh
Created Oct 30, 2017
Copying files using RDP connection from a linux machine
View copying_files_rdp_from_linux.sh
#!/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
View sed_doble_substitution.sh
#!/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 / remove_service_systemd.sh
Created Mar 15, 2017
remove startup service in systemd
View remove_service_systemd.sh
#!/bin/bash
sudo systemctl disable teamviewerd.service
Removed /etc/systemd/system/multi-user.target.wants/teamviewerd.service.
exit 0
@n1mh
n1mh / gist:bcb67cd2203a2d261ac0195f1dafacf0
Created Mar 1, 2017 — forked from iLoveTux/gist:c0c6216dca943876da6d
permit insecure connections with urllib2.urlopen in python 2.7.x >= 2.7.9
View gist:bcb67cd2203a2d261ac0195f1dafacf0
# Because migrating to python 2.7.9 requires me to update my code (or ask my clients to add cafiles to their trust store
# [which some people don't know how to do]), I found a way to explicitly allow insecure connections (ie. without hostname
# verification) using urllib2.urlopen()
#
# This gist basically involves creating an ssl.SSLContext() with some options which disable hostname verification
# This allows you to, for instance, add a parameter to a function which disables hostname verification.
import ssl
import urllib2
import logging
@n1mh
n1mh / device_not_managed.sh
Last active Feb 13, 2017
network-manager "device not managed"
View device_not_managed.sh
#!/bin/bash
sudo sed -i 's/managed=false/managed=true/g' /etc/NetworkManager/NetworkManager.conf
exit 0
@n1mh
n1mh / launch-wifi-wpa.sh
Created Feb 10, 2017
launch wireless connection using wpa_supplicant configuration
View launch-wifi-wpa.sh
#!/bin/bash
sudo wpa_supplicant \
-B \
-iwlan0 \
-c/etc/wpa_supplicant.conf \
-Dwext
sudo dhclient wlan0
sudo ifconfig wlan0
You can’t perform that action at this time.