This file contains 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
# This function takes first parameter ($1) | |
# to search on every enabled repository (on /etc/slpkg/slpkg.conf) | |
function slpkg-search() { | |
for r in $(slpkg repo-list | grep enabled | awk '{ print $1 }'); do | |
echo "Search in $r" | |
slpkg -l $r | grep -i $1 | |
echo "" | |
done | |
} |
This file contains 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
# This GIST should go inside your .zshrc file | |
# I use same .zshrc for normal and root user, so it's useful to change colors | |
# | |
# It will present PROMPT as: username@hostname dir $ or root@hostname dir # | |
# username on green chars | |
# root on red chars | |
# hostname on bold yellow chars | |
# directories on bold green chars | |
# | |
# RPROMPT should show a clock on the right |
This file contains 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 | |
# Get state of VGA output: connected|disconnected | |
# you can get output's names with xrandr -q | |
VGA=$(xrandr -q | grep VGA1 | cut -f2 -d" ") | |
# | |
# Setting LVDS1 as primary (netbook display) | |
PRIMARY="--output LVDS1 --primary --mode 1024x600 --pos 0x0 --rotate normal" | |
# | |
# Setting VGA1 as secondary, placed right of LVDS1 | |
SECONDARY="--output VGA1 --mode 1440x900 --pos 1024x0 --rotate normal" |
This file contains 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
function rtfm() { help $@ || $@ -h || $@ --help || man $@ || firefox -U "http://www.google.com/search?q=$@"; } |
This file contains 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 | |
# author: Diego 'dragonauta' Rucci | |
# version 0.2 | |
# CVLC is part of VLC package. It's a CLI tool. | |
# Some (flash-based) streamings can't be mounted on icecast2. | |
# solution is to play them with VLC (or cvlc) and redirect output to an icecast2 mountpoint | |
# ChangeLog | |
# Added variables to easily reuse script | |
STREAMING=<put-your-online-streaming-url-here> | |
USER=<put-your-icecast-user-here> |
This file contains 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
# Search shell history with peco: https://github.com/peco/peco | |
# Adapted from: https://github.com/mooz/percol#zsh-history-search | |
if which peco &> /dev/null; then | |
function peco_select_history() { | |
local tac | |
(which gtac &> /dev/null && tac="gtac") || \ | |
(which tac &> /dev/null && tac="tac") || \ | |
tac="tail -r" | |
BUFFER=$(fc -l -n 1 | eval $tac | \ | |
peco --layout=bottom-up --query "$LBUFFER") |
This file contains 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
$# es la cantidad de parámetros | |
$@ representa todos los parámetros, util para recorrerlos con un bucle for. | |
$? contiene el valor de salida del último comando ejecutado | |
$$ es el PID del shell | |
$* todos los parámetros como una única palabra, debe ir encomillado "$*" | |
$- banderas pasadas al script utilizando set | |
$! PID del último comando en background | |
$_ pasa el argumento del comando anterior al actual |
This file contains 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 | |
rsync -avz --delete -e ssh root@ip:/ruta/remota/ /ruta/local/ |
This file contains 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 | |
id=(your-id1 your-id2) | |
pass=(your-pass1 your-pass2) | |
tv=('Your PC1' 'Your PC2') | |
ITEMS="" | |
for item in {0..17}; do | |
ITEMS=$ITEMS" $item ${tv[$item]}" | |
echo $ITEMS | |
done |
OlderNewer