Skip to content

Instantly share code, notes, and snippets.

View keopx's full-sized avatar

Ruben Egiguren keopx

View GitHub Profile
@keopx
keopx / bash_prompt_git.sh
Created February 9, 2015 08:50
Bash prompt with git
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;36m\]\h \[\033[01;33m\]\w\[\033[1;37m\]$(__git_ps1) \[\033[01;35m\]\$ \[\033[00m\]'
@keopx
keopx / bash_color.sh
Created February 9, 2015 08:47
Bash prompt colors
# Reset
Color_Off="\[\033[0m\]" # Text Reset
# Regular Colors
Black="\[\033[0;30m\]" # Black
Red="\[\033[0;31m\]" # Red
Green="\[\033[0;32m\]" # Green
Yellow="\[\033[0;33m\]" # Yellow
Blue="\[\033[0;34m\]" # Blue
Purple="\[\033[0;35m\]" # Purple
@keopx
keopx / fucking_sudo.sh
Created January 27, 2015 09:34
Fucking sudo
echo "alias fucking=sudo" >> ~/.bashrc # The best alias you'll ever use. Think of the possibilities "fucking reboot"
@keopx
keopx / Revert_last_remote_commit
Created January 14, 2015 09:51
Revert last remote commit
git reset --hard HEAD~1
git push -f
@keopx
keopx / drupal-8.x_module.sh
Created December 25, 2014 13:10
How to create a #drupal8 module
curl -LSs http://drupalconsole.com/installer | php
mv console.phar /usr/local/bin/drupal
drupal generate:module
@keopx
keopx / recovery_kerner.sh
Created December 23, 2014 15:31
Recover kernel on boot system with raid and LVM
mount /dev/mapper/vg0-root /mnt
mount /dev/md0 /mnt/boot
mount /dev/mapper/vg0-var /mnt/var
mount /dev/mapper/vg0-data /mnt/data
mount -t dev -o bind /dev /mnt/dev
mount -t proc -o bind /proc /mnt/proc
mount -t sys -o bind /sys /mnt/sys
chroot /mnt
@keopx
keopx / mysql_optimize_all-tables
Created December 21, 2014 11:34
Optimize all mysql tables
mysqlcheck -o --all-databases
@keopx
keopx / custom_module.install
Last active August 29, 2015 14:11
Custom table using views
CREATE TABLE example_table (
nid INT(11) NOT NULL,
plain_text_field VARCHAR(32,
numeric_field INT(11),
boolean_field INT(1),
timestamp_field INT(8),
PRIMARY KEY(nid)
);
@keopx
keopx / gitconfig_log
Last active August 29, 2015 14:11
Git log decoration for see logs. Add lines to .git/config
git config --global alias.lg 'log --all --graph --decorate --oneline'
### OR ###
[alias]
lg = log --all --graph --decorate --oneline
@keopx
keopx / mymodule.install.php
Last active August 29, 2015 14:10
Adding multiple new fields to a table
<?php
// @see: https://www.drupal.org/node/150215
/**
* Add new fields to 'mytable' table.
*/
function MYMODULE_update_7001() {
$fields = array(
'field_name_1' => array(
'description' => 'Field name 1',