Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Both sides next revision
code:bash [2014/04/03 16:15]
alice created
code:bash [2026/02/05 15:21] (current)
84.138.194.42
Line 1: Line 1:
- 
 ====== bash ====== ====== bash ======
 +===== bashrc =====
 +<code>
 +# settings
 +TZ='Europe/Berlin'; export TZ
 +# path
 +export PATH="~/bin:/sbin:/usr/sbin:/usr/local/sbin:${PATH}"
 +export XDG_DATA_HOME=~/.config
 +export XDG_CACHE_HOME=~/.cache
 +# sys
 +[ -f ~/.bash_alias ] && source ~/.bash_alias
 +[ -f /etc/profile.d/bash-completion ] && source /etc/profile.d/bash-completion
 +
 +
 +# editor
 +set -o vi
 +export EDITOR="vim"
 +umask 022
 +
 +# history
 +export HISTFILESIZE=10000
 +export HISTSIZE=10000
 +shopt -s histappend
 +export HISTCONTROL=ignoredups
 +export LS_OPTIONS='--color=auto'
 +eval `dircolors $HOME/.dircolors`
 +
 +# start screen
 +if [[ $- = *i* && -z "$STY" ]]; then exec screen -dR chat irssi; fi
 +</code>
 +
 +===== snippets =====
 +  # macros
 +    [ $1 ] || { echo -ne "\033[0m>>> usage: $0 <target>\n" >&2; exit 1; }
 +
 +  ### pipes
 +  ## sqlite to html
 +    sqlite3 ex1 'select * from tbl1' | awk '{printf "<tr><td>%s<td>%s\n",$1,$2 }'
  
 +  ### tools
 +  ## remove html
 +    lynx -dump 
 + 
 ===== ip and gateway ===== ===== ip and gateway =====
  
Line 32: Line 72:
  
 </code> </code>
 +
 +==== youtube-dl ====
 +
 +* https://github.com/rg3/youtube-dl.git
 +
 +<file bash yt.sh>
 +#!/bin/sh
 +COOKIE_FILE=/var/tmp/youtube-dl-cookies.txt
 +for i in $*; do
 +  mplayer -cookies -cookies-file ${COOKIE_FILE} $(youtube-dl -g --cookies ${COOKIE_FILE} $i)
 +done
 +</file>
 +
 +==== mysql ====
 +
 +  ex='mysql -u root -pxxx mydb -e '
 +  min() { echo $(( $1 < $2 ? $1 : $2 )); }
 +  i=470;m=479; while [[ "$i" -le "$m" ]]; do 
 +    a=$i;b=$(min $((i+2)) $m);i=$((i+3));                                                                                                        
 +    $ex "insert into postlabel (fsid,lsid) values ($a, $b)"; done;
 +    
 +    
 +echo "test?"
 +

Log In