Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

lucasea777

🏠
Working from home
View GitHub Profile
@lucasea777
lucasea777 / index.html
Created Jul 27, 2019
Parallax.js in React
View index.html
<div id="svg_mount_example"></div>
@lucasea777
lucasea777 / Dockerfile
Created May 4, 2019 — forked from dsuess/Dockerfile
xeus-cling C++ Jupyter kernel inside a docker container
View Dockerfile
FROM frolvlad/alpine-miniconda3
RUN conda install -y -c conda-forge bash jupyter jupyter_contrib_nbextensions
RUN conda install -y -c conda-forge xeus-cling xtensor
RUN mkdir /notebooks
@lucasea777
lucasea777 / ppmatrix.py
Created Jun 8, 2018
Pretty print matrix with colors proportional to each value.
View ppmatrix.py
import numpy as np
# https://stackoverflow.com/questions/4842424/list-of-ansi-color-escape-sequences
A = np.random.randint(-100, 100, size=(7, 7))
def pformat(A, header=True):
mv = min([min([int(v) for v in row]) for row in A])
Mv = max([max([int(v) for v in row]) for row in A])
f = lambda r, m, M: int(- (255*r)/(m - M) + (255*m)/(m-M))
#c = '\033[38;2;{1};{2};{3};48;2;0;0;0m{0}\033[0m'.format
c = '\033[38;2;{1};{2};{3}m{0}\033[0m'.format
middle = (Mv - mv)/2 + mv
@lucasea777
lucasea777 / build.sh
Created May 19, 2018 — forked from Artanis/build.sh
Python C Extension Hello World
View build.sh
gcc -fpic --shared $(python3-config --includes) greetmodule.c -o greet.abi3.so
# can also use $(pkg-config --cflags python-3.5)
# or
# python3 setup.py install --record files.txt --user
View auto-remove-sublime-license-popup
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sublime_plugin
import subprocess
from time import sleep
import sys
cl = lambda line: subprocess.Popen(line, shell=True, stdout=subprocess.PIPE).communicate()[0].strip()
log = lambda message: sys.stderr.write("Log: %s\n" % message)
@lucasea777
lucasea777 / httpget.js
Created Oct 7, 2016 — forked from duncansmart/httpget.js
Download a file with Windows Script Host
View httpget.js
// httpget.js: download a file (Windows Script Host)
// usage: cscript httpget.js <url> <file>
(function() {
if (WScript.Arguments.Length != 2) {
WScript.Echo("Usage: httpget.js <url> <file>")
WScript.Quit(1)
}
var url = WScript.Arguments(0)
View SimpleHTTPServerWithUpload.py
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""