Skip to content

Instantly share code, notes, and snippets.

View lucasea777's full-sized avatar
🏠
Working from home

lucasea777

🏠
Working from home
View GitHub Profile
@lucasea777
lucasea777 / SimpleHTTPServerWithUpload.py
Created February 26, 2016 02:42 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/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.
"""
@lucasea777
lucasea777 / httpget.js
Created October 7, 2016 17:08 — forked from duncansmart/httpget.js
Download a file with Windows Script Host
// 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)
@lucasea777
lucasea777 / auto-remove-sublime-license-popup
Created March 4, 2018 15:05 — forked from egel/auto-remove-sublime-license-popup
Auto-remove Sublime's 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 / build.sh
Created May 19, 2018 02:15 — forked from Artanis/build.sh
Python C Extension Hello World
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
@lucasea777
lucasea777 / ppmatrix.py
Created June 8, 2018 18:26
Pretty print matrix with colors proportional to each value.
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 / Dockerfile
Created May 4, 2019 21:38 — forked from dsuess/Dockerfile
xeus-cling C++ Jupyter kernel inside a docker container
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 / index.html
Created July 27, 2019 13:32
Parallax.js in React
<div id="svg_mount_example"></div>