Skip to content

Instantly share code, notes, and snippets.

@zblanco
zblanco / getting_lazy_with_dataflow_graphs_in_elixir.livemd
Last active June 30, 2024 11:45
Getting Lazy with Dataflow Graphs in Elixir

Getting Lazy with Dataflow Graphs in Elixir

Intro

What do Tensorflow, Apache Airflow, Rule Engines, and Excel have in common?

Under the hood they all use DAGs to model data-flow dependencies of the program. Using graphs to model programs is great because you can modify the program at runtime. Lets talk about doing this in Elixir for great good.

@getflourish
getflourish / Import CustomElements from .html files.md
Last active June 23, 2024 15:01
Import CustomElements from .html files

Import CustomElements from .html files

This is the technical implementation of the idea and concept described in my article “Why don’t we use HTML to author web components?

Instead of using template literals, constructors and other specifics to define CustomElements, this is a proposal to just use standard HTML to define CustomElements.

The goal is to import CustomElements like this:

@rdinse
rdinse / Google_Colaboratory_backup.py
Created March 13, 2018 22:55
Simple Google Drive backup script with automatic authentication for Google Colaboratory (Python 3)
# Simple Google Drive backup script with automatic authentication
# for Google Colaboratory (Python 3)
# Instructions:
# 1. Run this cell and authenticate via the link and text box.
# 2. Copy the JSON output below this cell into the `mycreds_file_contents`
# variable. Authentication will occur automatically from now on.
# 3. Create a new folder in Google Drive and copy the ID of this folder
# from the URL bar to the `folder_id` variable.
# 4. Specify the directory to be backed up in `dir_to_backup`.
@rlipscombe
rlipscombe / exwx.exs
Created November 26, 2017 16:08
Using wxWidgets from Elixir
#!/usr/bin/env elixir
defmodule Canvas do
@behaviour :wx_object
@title "Canvas Example"
@size {600, 600}
def start_link() do
:wx_object.start_link(__MODULE__, [], [])
@phmagic
phmagic / tensorflow-macOS-sierra-GT750M-CUDA8.md
Last active November 4, 2021 06:48
Install TensorFlow GPU on NVIDIA GeForce GT 750M on macOS Sierra 10.12

Current as of Sept 6, 2017

I have a MacBook Pro Retina 2013 and I had a hard time setting up TensorFlow with GPU support from all the conflicting information out there. I hope this gets you up and running training models on your local computer!

  1. Download the CUDA Toolkit 8.0 for macOS here. Install it using the DMG package.
  2. Edit your ~/.bash_profile file and add the following line: export DYLD_LIBRARY_PATH="/Developer/NVIDIA/CUDA-8.0/lib:$DYLD_LIBRARY_PATH"
  3. Download the CUDA DNN v5.1 from here. This requires you to sign up as an NVIDIA Developer.
  4. Unzip the CUDA DNN package and copy the files inside the include folder to Developer/NVIDIA/CUDA-8.0/include and copy the files inside the lib folder into Developer/NVIDIA/CUDA-8.0/lib
  5. Inside your terminal, do source ~/.bash_profile
@uchcode
uchcode / JXA-WebView.js
Created December 31, 2016 06:57
JXA (JavaScript for Automation) WebView applet template.
ObjC.import('Cocoa')
ObjC.import('WebKit')
MyWindow = WebViewWindow('http://www.youtube.com/')
MyWindow.makeKeyAndOrderFront(null)
//=====================================================================
function Window(x, y, width, height) {
let r = $.NSMakeRect(x, y, width, height)
@cure53
cure53 / wasm.md
Last active October 17, 2023 00:16
Calling alert from WASM

Calling alert from WebAssembly (WASM)

This very simple and minimal tutorial documents in a few easy steps how to play with WebAssembly (WASM) and get first results within minutes.

While the code below is mostly useless, it will show, how to call the alert function from within a WASM file and thus demonstrate how to import and export DOM objects.

Of course, this exercise has no real use. It is just meant to show, that getting started with WASM isn't hard. And there is no need for a complex build-chain, tons of tools or a dedicated VMs. Just use a browser, one online tool and that's it.

And Now?

@kylemcdonald
kylemcdonald / showarray.py
Created January 3, 2016 08:56
Minimal code for rendering a numpy array as an image in a Jupyter notebook in memory. Borrowed from the Deep Dream notebook.
import PIL.Image
from cStringIO import StringIO
import IPython.display
import numpy as np
def showarray(a, fmt='png'):
a = np.uint8(a)
f = StringIO()
PIL.Image.fromarray(a).save(f, fmt)
IPython.display.display(IPython.display.Image(data=f.getvalue()))
@jcupitt
jcupitt / composite2.c
Last active April 18, 2017 04:49
use libvips to compose two images with alpha channels
/* compile with:
*
* gcc -g -Wall composite2.c `pkg-config vips --cflags --libs`
*/
#include <stdio.h>
#include <vips/vips.h>
/* Composite images a and b.
*/