Skip to content

Instantly share code, notes, and snippets.

@xezpeleta
xezpeleta / LFCS_study
Last active August 29, 2015 14:17 — forked from gojun077/LFCS_study
* LFCS Domains 2015.02
Note - the domains will change somewhat in March 2015. SW RAID
with mdadm will be removed
** The Command Line
*** Editing text files on the CLI
Covers the use of the basic text editors nano and gedit as well
as the advanced editors _vi_ and _emacs_
- nano
simple CLI-based text editor
@xezpeleta
xezpeleta / guardian-source
Last active August 29, 2015 14:22
Playing with the Guardian source
# Example
git clone [email protected]:guardian/ge2015-results-interactive.git
sudo npm install -g grunt-cli
sudo npm install -g bower
sudo npm install -g sass
sudo npm install
bower install
grunt (--force)
@xezpeleta
xezpeleta / add_ga_code.py
Last active November 3, 2015 08:34
Set up Google Analytics web tracking code
#! /usr/bin/python
'''
Python script to set up GA web tracking code, usually in static web files (in PHP files, you can use a simple 'include' or 'require_once').
add_ga_code.py <file> <track-id>
Example: add_ga_code.py /var/www/index.html UA-557744-10
To add the tracking code in multiple files, use a oneliner. Example:
@xezpeleta
xezpeleta / update-wordpress.sh
Last active April 29, 2016 11:07
Keep your WordPress installations updated
#! /bin/sh
##
# update-wordpress.sh It will update your WordPress installation using the utility wp-cli http://wp-cli.org
# To keep your WP updated, you can copy this script into your /etc/cron.daily directory
# Don't forget to add execution right and remove ".sh" extension from the filename.
##
WPDIR=/var/www/myblog
@xezpeleta
xezpeleta / mantis-users-survey.php
Last active November 4, 2015 11:54
It sends a satisfaction survey to the Mantis user when the bug is closed
#! /usr/bin/php
<?php
##
# mantis-users-survey.php: Asebetetze inkestaren esteka bidaltzen zaio erabiltzaileari, bere matxura
# itxi ostean. Horretarako, script hau egunero exekutatu behar da CRON bitartez.
# Adibidez:
# 55 23 * * * /root/scripts/mantis-users-survey.php >> /root/scripts/mantis-survey.log
##
#! /bin/sh
##
# update-drupal.sh It will update your Drupal installation using the utility Drush http://www.drush.org
# To keep your Drupal updated, you can copy this script into your /etc/cron.daily directory
# Don't forget to add execution right and remove ".sh" extension from the filename.
##
cd /var/www/mydrupalsite
drush up -y
#! /bin/bash -e
#
# Usage:
# ./eb-installer.sh [OPTIONS]
# [-f customconfigfile] [-h dbhost] [-u dbuser]
# [-U dbadminuser] [-p dbpass] [-P dbadminpass]
# [-n dbname] [-v version] [-y] [-d] [-I]
# Config
@xezpeleta
xezpeleta / reboot-when-required
Last active May 29, 2017 12:21
Ubuntu server: reboot on "system restart required" with CRON
#! /bin/sh -e
#
# File: /etc/cron.daily/reboot-when-required
# Description: reboots the machine if its required
if [ -f /var/run/reboot-required ]; then
shutdown -r +5 "Reboot required. System will be restarted in 5min."
fi
@xezpeleta
xezpeleta / bash-on-windows-uninstall.bat
Last active December 1, 2016 16:11
Bash on Windows installer script (work in progress)
REM Uninstall Bash on Windows
lxrun /uninstall /full /y
REM TODO: Disable WSL feature
REM TODO: Disable Developer Mode
REM debugging-pause
pause