- Works even under the most spartan conditions (in a simple remote shell window such as xterm, putty), with syntax highlighting, function folding, tabs, buffers, and all that lightning fast
- Delete lines matching pattern:
g/pattern/d
- Delete lines not matching pattern:
g!/pattern/d
- Sort buffer:
:%sort
- Filter buffer through command
:%!sort -u
- Delete from current line until end of file (try with a large file!)
- Increment numeric values:
C-a
,C-x
- Complete line pattern
C-x C-l
- Convert a DOS file (with CRLF line endings) to UNIX:
:set ff=unix
(and then save it)
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 -e | |
pattern=$1 | |
for zip in *.zip; do | |
while IFS=: read fn count; do | |
echo Zip File : $zip has text file : $fn has $pattern $count times | |
done < <(zipgrep -c "$1" "$zip" | grep -v :0) | |
done |
http://winterbash2013.stackexchange.com/
- 5 reviews in 5 queues
- award bounty
- starred chat on NYD
- 5+ helpful flags, <= 20% declined
- edit a cw post
- reopen or undelete question
- gold badge
- first post scored 1+
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
#!/usr/bin/env python | |
import sys | |
s1 = sys.argv[1] | |
s2 = sys.argv[2] | |
def longest(s1, s2): | |
def longest(i): | |
suffix = s2[i:] | |
if s1.startswith(suffix): |
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
# requirements: python, virtualenv, pip | |
# | |
# create a virtualenv -- I keep all my virtualenvs in ~/virtualenv | |
virtualenv --distribute ~/virtualenv/coursera | |
# activate virtualenv | |
. ~/virtualenv/coursera/bin/activate | |
# get the coursera downloader tool and install requirements |
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/sh | |
cat /home/level02/.password |
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
[email protected] | |
function mailme() { | |
file=$1 | |
if test -f $file; then | |
uuencode $file $file.txt | mailx -s $file $EMAIL | |
else | |
mailx $* $EMAIL | |
fi | |
} |
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
# usage: PW=the_pw . ~/scripts/proxy.sh" | |
# edit this depending on your environment | |
template='http://USERNAME:$PW@PROXYURL:PROXYPORT' | |
if test "$PW"; then | |
clear | |
echo "* note: cleared the screen for your safety" | |
echo "* using proxy address template: $template" | |
proxy_address=$(eval echo $template) |
// where the hell my log4j settings come from??
System.out.println(Loader.getResource("log4j.properties"));
System.out.println(Loader.getResource("log4j.xml"));
-- "create" a user in MySQL
GRANT ALL PRIVILEGES ON dbname.* TO 'dbuser'@localhost IDENTIFIED BY 'userpass';