Skip to content

Instantly share code, notes, and snippets.

@shalevy1
shalevy1 / docker-automation.py
Created March 9, 2023 04:46 — forked from yetanotherchris/docker-automation.py
Automating Docker images and containers with Python ()
'''
This script brings up the entire stack of Docker containers, removing the current ones.
Docker compose was tried for this task and it wasn't customisable enough.
Docker cloud was tried (with stack files) and was buggy (failed to launch, no logs returned).
Docker machine was tried, but it can't connect to existing servers only ones it created.
Rancher was too heavy weight for the task, as the containers are lightweight in DigitalOcean.
Kubernetes would've been too heavy weight for DigitalOcean.
It was written in Powershell and worked. But then converting it to Bash was too much effort.
Powershell for Linux is too much effort to install without a debian package (and none standard)
@shalevy1
shalevy1 / serialize-numpy-array.py
Created February 15, 2023 23:54 — forked from alexland/serialize-numpy-array.py
serialize, persist, retrieve, and de-serialize a NumPy array as a binary string (any dimension, any dtype); exemplary use case: a web app calculates some result--eg, from a Machine Learning algorithm, using NumPy and the result is a NumPy array; it is efficient to just return that result to rather than persist the array then retrieve it via query
import time
import numpy as NP
from redis import StrictRedis as redis
# a 2D array to serialize
A = 10 * NP.random.randn(10000).reshape(1000, 10)
# flatten the 2D NumPy array and save it as a binary string
array_dtype = str(A.dtype)
@shalevy1
shalevy1 / gist:c628866249a5c9788581fa95039acd65
Created January 10, 2023 18:59 — forked from dlferro/gist:3004639
Leaflet Image Deepzoom
<html>
<head>
<link rel="stylesheet" href="lib/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="lib/leaflet.ie.css" />
<![endif]-->
</head>
<body>
<div id="map" style="width:1004px; height:748px; border: 1px solid black;"></div>
<script type="text/javascript" src="lib/leaflet-src.js"></script>
@shalevy1
shalevy1 / index.html
Created January 10, 2023 18:58 — forked from jieter/index.html
Leaflet.Markercluster + leaflet-image
<!DOCTYPE html>
<html>
<head>
<title>Leaflet debug page</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet-src.js"></script>
@shalevy1
shalevy1 / .block
Created January 10, 2023 06:29 — forked from rpgove/.block
Group-in-a-box layout
license: gpl-3.0
height: 302
@shalevy1
shalevy1 / .block
Created January 10, 2023 06:29 — forked from rpgove/.block
Force-directed layout
license: gpl-3.0
height: 600
@shalevy1
shalevy1 / index.html
Created December 30, 2022 01:01 — forked from darrenjaworski/index.html
Leaflet image zoom with layers
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.css" />
<script src="http://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script>
<style>
@shalevy1
shalevy1 / topicModeling.ipynb
Created December 29, 2022 22:21 — forked from fmnobar/topicModeling.ipynb
Topic Modeling
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shalevy1
shalevy1 / sentimentAnalysis.ipynb
Created December 29, 2022 22:21 — forked from fmnobar/sentimentAnalysis.ipynb
Sentiment Analysis
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
text label
A very, very, very slow-moving, aimless movie about a distressed, drifting young man. 0
Not sure who was more lost - the flat characters or the audience, nearly half of whom walked out. 0
Attempting artiness with black & white and clever camera angles, the movie disappointed - became even more ridiculous - as the acting was poor and the plot and lines almost non-existent. 0
Very little music or anything to speak of. 0
The best scene in the movie was when Gerardo is trying to find a song that keeps running through his head. 1
The rest of the movie lacks art, charm, meaning... If it's about emptiness, it works I guess because it's empty. 0
Wasted two hours. 0
Saw the movie today and thought it was a good effort, good messages for kids. 1
A bit predictable. 0