Skip to content

Commit 7daa062

Browse files
committed
Add some very old folders
1 parent 234a9d7 commit 7daa062

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def test():
2+
"""This line is longer than 80 chars, but , for me this is ok inside a DOCSTRING,
3+
this one is shorter.
4+
"""
5+
6+
if 'This is toooooooooooooooooooooooooooooooooooo longggggggggggggggggggggggg':
7+
print 'True'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
2+
3+
link: http://stackoverflow.com/questions/18993438/shebang-env-preferred-python-version
4+
5+
6+
```sh
7+
#!/bin/sh
8+
''''which python2 >/dev/null && exec python2 "$0" "$@" # '''
9+
''''which python >/dev/null && exec python "$0" "$@" # '''
10+
```
11+
12+
```sh
13+
#!/bin/bash
14+
pfound=false; v0=2; v1=6
15+
for p in /{usr/,}bin/python*; do
16+
v=($(python -V 2>&1 | cut -c 7- | sed 's/\./ /g'))
17+
if [[ ${v[0]} -eq $v0 && ${v[1]} -eq $v1 ]]; then pfound=true; break; fi
18+
done
19+
if ! $pfound; then echo "no suitable python version (2.6.x) found."; exit 1; fi
20+
$p - $* <<EOF
21+
22+
PYTHON SCRIPT GOES HERE
23+
24+
EOF
25+
```
26+
27+
```sh
28+
#!/bin/sh
29+
''''exec python -u -- "$0" ${1+"$@"} # '''
30+
```
31+
32+
```sh
33+
#!/bin/sh
34+
''':'
35+
exec python -tt "$0" "$@"
36+
'''
37+
# The above shell shabang trick is more portable than /usr/bin/env and supports adding arguments to the interpreter (python -tt)
38+
```
39+
40+
link: http://stackoverflow.com/questions/12070516/conditional-shebang-line-for-different-versions-of-python?lq=1
41+
42+
```sh
43+
#!/bin/sh
44+
# -*- mode: Python -*-
45+
46+
""":"
47+
# bash code here; finds a suitable python interpreter and execs this file.
48+
# prefer unqualified "python" if suitable:
49+
python -c 'import sys; sys.exit(not (0x020500b0 < sys.hexversion < 0x03000000))' 2>/dev/null \
50+
&& exec python "$0" "$@"
51+
for pyver in 2.6 2.7 2.5; do
52+
which python$pyver > /dev/null 2>&1 && exec python$pyver "$0" "$@"
53+
done
54+
echo "No appropriate python interpreter found." >&2
55+
exit 1
56+
":"""
57+
58+
import sys
59+
print sys.version
60+
```
61+
62+
link: https://github.com/apache/cassandra/blob/trunk/bin/cqlsh

0 commit comments

Comments
 (0)