Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am x10an14 on github.
  • I am x10an14 (https://keybase.io/x10an14) on keybase.
  • I have a public key whose fingerprint is ECE7 FBF2 D4BB D013 91CA 2197 F7BC 515F D1B6 17EE

To claim this, I am signing this object:

@x10an14
x10an14 / timeit.py
Last active May 26, 2016 19:34
A Python function wrapper which in Python 3.3+ uses the most accurate timing measurements
# Original honor: http://stackoverflow.com/a/15136358/1503549
import time
def timeit(f):
def decorated_function(*args, **kw):
# Time execution
starttime = time.perf_counter()
result = f(*args, **kw)
@x10an14
x10an14 / coconut_ipython_virtualenv_attempt.txt
Last active September 4, 2016 20:34
Coconut IPython error testing
x10an14@x10Desktop2016:~$ python --version
Python 3.5.2
x10an14@x10Desktop2016:~$ cd Documents/coconut/
x10an14@x10Desktop2016:~/Documents/coconut$ rm -rf venv/
x10an14@x10Desktop2016:~/Documents/coconut$ la
total 32K
drwxrwxr-x 2 x10an14 x10an14 4,0K sep. 4 22:14 ./
drwxr-xr-x 6 x10an14 x10an14 4,0K sep. 4 21:43 ../
-rw-rw-r-- 1 x10an14 x10an14 41 sep. 4 21:48 hello_world.coco
-rw-rw-r-- 1 x10an14 x10an14 15K sep. 4 21:48 hello_world.py
@x10an14
x10an14 / windows_coconut_ipython_console_attempt.txt
Last active September 5, 2016 06:12
Attempt at starting IPython Coconut shell/console on Windows
C:\> cd .\coconut\
C:\coconut> virtualenv.exe -p "C:\Program Files\Python35\python.exe" venv
Running virtualenv with interpreter C:\Program Files\Python35\python.exe
Using base prefix 'C:\\Program Files\\Python35'
New python executable in C:\coconut\venv\Scripts\python.exe
Installing setuptools, pip, wheel...done.
C:\coconut> .\venv\Scripts\pip install ipython jupyter coconut --trusted-host pypi.python.org
Collecting ipython
Downloading ipython-5.1.0-py3-none-any.whl (747kB)
100% |████████████████████████████████| 747kB 6.0MB/s ████████████████| 747kB 6.0MB/s �█████| 747kB 6.0MB/s B 6.0MB/s
@x10an14
x10an14 / console_log.txt
Created September 5, 2016 11:08
Still unable to open Coconut interactive console after installing Jupyter into 'machine PATH'.
C:\coconut> pip install jupyter
Collecting jupyter
Could not fetch URL https://pypi.python.org/simple/jupyter/: There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645) - skipping
Could not find a version that satisfies the requirement jupyter (from versions: )
No matching distribution found for jupyter
C:\coconut> pip install jupyter --trusted-host pypi.python.org
Collecting jupyter
Downloading jupyter-1.0.0-py2.py3-none-any.whl
Collecting nbconvert (from jupyter)
Downloading nbconvert-4.2.0-py2.py3-none-any.whl (319kB)
@x10an14
x10an14 / another_attempt_at_coconut_interactive_shell.txt
Created September 6, 2016 06:23
Steps described to work on Windows don't work on Linux.
x10an14@x10Desktop2016:~$ cd Documents/coconut/
x10an14@x10Desktop2016:~/Documents/coconut$ la
total 36K
drwxrwxr-x 3 x10an14 x10an14 4,0K sep. 4 22:15 ./
drwxr-xr-x 6 x10an14 x10an14 4,0K sep. 4 21:43 ../
-rw-rw-r-- 1 x10an14 x10an14 41 sep. 4 21:48 hello_world.coco
-rw-rw-r-- 1 x10an14 x10an14 15K sep. 4 21:48 hello_world.py
-rw-rw-r-- 1 x10an14 x10an14 53 sep. 4 22:08 requirements.txt
drwxrwxr-x 6 x10an14 x10an14 4,0K sep. 4 22:15 venv/
x10an14@x10Desktop2016:~/Documents/coconut$ rm -rf venv
@x10an14
x10an14 / yet_another_attempt_now_on_linux.txt
Last active September 6, 2016 19:53
Coconut console attempt with activated virtualenv on Linux
x10an14@x10Desktop2016:~$ cd Documents/coconut/
x10an14@x10Desktop2016:~/Documents/coconut$ la
total 36K
drwxrwxr-x 3 x10an14 x10an14 4,0K sep. 4 22:15 ./
drwxr-xr-x 6 x10an14 x10an14 4,0K sep. 4 21:43 ../
-rw-rw-r-- 1 x10an14 x10an14 41 sep. 4 21:48 hello_world.coco
-rw-rw-r-- 1 x10an14 x10an14 15K sep. 4 21:48 hello_world.py
-rw-rw-r-- 1 x10an14 x10an14 53 sep. 4 22:08 requirements.txt
drwxrwxr-x 6 x10an14 x10an14 4,0K sep. 4 22:15 venv/
x10an14@x10Desktop2016:~/Documents/coconut$ rm -rf venv
@x10an14
x10an14 / gist:e21c871861dd62994734586505d20981
Last active September 7, 2016 21:06
Another Coconut console attempt, but now with polluting global space of machine (no virtualenv involved) on Linux
x10an14@x10Desktop2016:~$ pip3 freeze
apturl==0.5.2
beautifulsoup4==4.4.1
blinker==1.3
Brlapi==0.6.4
chardet==2.3.0
checkbox-support==0.22
command-not-found==0.3
cryptography==1.2.3
defer==1.0.6
@x10an14
x10an14 / gist:630628df1f4745e8778d6a5eba77d72e
Created September 28, 2016 23:04
Pre-commit Coconut dockerization command error on alpine build
An unexpected error has occurred: CalledProcessError: Command: ('/root/.pre-commit/repoy8j7p4sj/py_env-default/bin/python3.5', '/root/.pre-commit/repoy8j7p4sj/py_env-default/bin/pip', 'install', '.')
Return code: 2
Expected return code: 0
Output:
Processing /root/.pre-commit/repoy8j7p4sj
Errors:
Exception:
Traceback (most recent call last):
File "/root/.pre-commit/repoy8j7p4sj/py_env-default/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main
@x10an14
x10an14 / Attempt_nr2.txt
Last active September 30, 2016 07:04
Coconut test segfault in minimized alpine docker container image
$ docker run -it --entrypoint bash test
bash-4.3# coconut tests/src/extras.coco tests/dest --run
Coconut: Compiling tests/src/extras.coco ...
Coconut: Compiled to tests/dest/extras.py .
CoconutWarning: missing new line at end of file (line 1)
abc
^
CoconutWarning: missing new line at end of file (line 1)
abc
^