Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tristan Cavelier
toolbox
Commits
68456732
Commit
68456732
authored
Nov 04, 2016
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add CrOS bashrc sample
parent
0935ddc4
Pipeline
#3300
skipped
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
0 deletions
+68
-0
cros-bashrc.sample.bash
cros-bashrc.sample.bash
+68
-0
No files found.
cros-bashrc.sample.bash
0 → 100644
View file @
68456732
#!/bin/bash
[[
$-
!=
*
i
*
]]
&&
return
[
"
$(
pwd
)
"
=
/
]
&&
cd
~/Downloads
alias ls
=
'ls -CF --color=auto'
alias
l
=
'ls -lF'
alias
lh
=
'ls -hAl'
alias
la
=
'ls -la'
alias
ll
=
'ls -l'
export
EDITOR
=
vim
tree
()
{
python
-Sc
'import sys, os
aa = sys.argv[1:] or ["."]
for a in aa:
o = len(a.split(os.sep))
for r, dd, ff in os.walk(a):
dp = len(r.split(os.sep)) - o + 1
print "%s- %s" % ((dp - 1) * " ", os.path.basename(r))
for f in ff:
print "%s- %s" % (dp * " ", f)'
"
$@
"
}
showzip
()
{
[
$#
=
1
]
||
{
echo
"Usage: showzip ZIPFILE"
>
&2
;
return
1
;
}
python
-Sc
'import sys, zipfile
zfile = zipfile.ZipFile(sys.argv[1])
zfile.printdir()
zfile.close()'
"
$@
"
}
zip
()
{
[
$#
-gt
1
]
||
{
echo
"Usage: zip ZIPFILE FILE..."
>
&2
;
return
1
;
}
python
-Sc
'import sys, zipfile, os
if os.path.lexists(sys.argv[1]):
sys.stderr.write("zip: file %r already exists\n" % sys.argv[1])
sys.exit(1)
zfile = zipfile.ZipFile(sys.argv[1], "w", zipfile.ZIP_DEFLATED)
def arc(arg):
if os.path.islink(arg):
sys.stderr.write("zip: symlink %r ignored\n" % arg)
elif os.path.isdir(arg):
for r, _, ff in os.walk(arg):
zfile.write(r)
for f in ff: arc(os.path.join(r, f))
else:
zfile.write(arg)
for arg in sys.argv[2:]: arc(arg)
zfile.close()'
"
$@
"
}
unzip
()
{
[
$#
!=
0
]
||
{
echo
"Usage: unzip ZIPFILE [TARGET]"
>
&2
;
return
1
;
}
python
-Sc
'import sys, zipfile
zfile = zipfile.ZipFile(sys.argv[1])
zfile.extractall(sys.argv[2] if len(sys.argv) > 2 else ".")
zfile.close()'
"
$@
"
}
__PS1_last_code
()
{
local
res
=
$?
[
$res
=
0
]
||
echo
-n
$'
\1
'$'
\0
33[01;31m'$'
\2
'
"
$res
"
return
$res
}
# chronos@localhost ~/Downloads $ false
# chronos@localhost ~/Downloads 1 $
export
PS1
=
"
$(
echo
"
$PS1
"
|
head
-c
-16
)
\$
(__PS1_last_code)
$(
echo
"
$PS1
"
|
tail
-c
-16
)
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment